2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Allow editing ManageTopics rights/restrictions.

This commit is contained in:
John Preston
2022-10-24 11:23:21 +04:00
parent ed895ace66
commit 53beb6f562
9 changed files with 261 additions and 201 deletions

View File

@@ -224,6 +224,7 @@ ChatAdminRightsInfo EditAdminBox::defaultRights() const {
| Flag::BanUsers
| Flag::InviteUsers
| Flag::PinMessages
| Flag::ManageTopics
| Flag::ManageCall) }
: ChatAdminRightsInfo{ (Flag::ChangeInfo
| Flag::PostMessages
@@ -328,13 +329,17 @@ void EditAdminBox::prepare() {
const auto anyoneCanAddMembers = chat
? chat->anyoneCanAddMembers()
: channel->anyoneCanAddMembers();
const auto options = Data::AdminRightsSetOptions{
.isGroup = isGroup,
.isForum = peer()->isForum(),
.anyoneCanAddMembers = anyoneCanAddMembers,
};
auto [checkboxes, getChecked, changes] = CreateEditAdminRights(
inner,
tr::lng_rights_edit_admin_header(),
prepareFlags,
disabledMessages,
isGroup,
anyoneCanAddMembers);
options);
inner->add(std::move(checkboxes), QMargins());
auto selectedFlags = rpl::single(
@@ -355,7 +360,7 @@ void EditAdminBox::prepare() {
}, lifetime());
if (canTransferOwnership()) {
const auto allFlags = AdminRightsForOwnershipTransfer(isGroup);
const auto allFlags = AdminRightsForOwnershipTransfer(options);
setupTransferButton(
inner,
isGroup
@@ -746,7 +751,8 @@ void EditRestrictedBox::prepare() {
this,
tr::lng_rights_user_restrictions_header(),
prepareFlags,
disabledMessages);
disabledMessages,
{ .isForum = peer()->isForum() });
addControl(std::move(checkboxes), QMargins());
_until = prepareRights.until;