From 1de144a48d9022b1261229a614db8a0d8f8d2972 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 23 Oct 2020 17:37:27 +0300 Subject: [PATCH] Show transfer ownership button for non-anonymous admins. --- Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp | 2 +- .../SourceFiles/boxes/peers/edit_peer_permissions_box.cpp | 6 ++++-- .../SourceFiles/boxes/peers/edit_peer_permissions_box.h | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp index d23abb04c6..7f82a7f3bb 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participant_box.cpp @@ -308,7 +308,7 @@ void EditAdminBox::prepare() { }, lifetime()); if (canTransferOwnership()) { - const auto allFlags = FullAdminRights(isGroup); + const auto allFlags = AdminRightsForOwnershipTransfer(isGroup); setupTransferButton( isGroup )->toggleOn(rpl::duplicate( diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index 29ac53e516..91e0a0dfe0 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -298,10 +298,12 @@ ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions) { return restrictions; } -ChatAdminRights FullAdminRights(bool isGroup) { +ChatAdminRights AdminRightsForOwnershipTransfer(bool isGroup) { auto result = ChatAdminRights(); for (const auto &[flag, label] : AdminRightLabels(isGroup, true)) { - result |= flag; + if (!(flag & ChatAdminRight::f_anonymous)) { + result |= flag; + } } return result; } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.h b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.h index 53f16ea38e..b7dfd4ed07 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.h +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.h @@ -71,4 +71,4 @@ EditFlagsControl CreateEditAdminRights( ChatAdminRights DisabledByDefaultRestrictions(not_null peer); ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions); -ChatAdminRights FullAdminRights(bool isGroup); +ChatAdminRights AdminRightsForOwnershipTransfer(bool isGroup);