diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index dedca84f8c..3ecd42467f 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -5981,12 +5981,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_rights_edit_admin_header" = "What can this admin do?"; "lng_rights_edit_admin_rank_name" = "Custom title"; "lng_rights_edit_admin_rank_about" = "A title that members will see instead of '{title}'."; -"lng_manage_peer_custom_tags" = "Allow Members Tags"; -"lng_manage_peer_custom_tags_about" = "Turn this on to let members of the group add short tags next to their names."; -"lng_context_add_my_tag" = "Add Tag"; -"lng_context_edit_my_tag" = "Edit Tag"; -"lng_context_add_member_tag" = "Add Member Tag"; -"lng_context_edit_member_tag" = "Edit Member Tag"; +"lng_context_add_my_tag" = "Add tag"; +"lng_context_edit_my_tag" = "Edit tag"; +"lng_context_add_member_tag" = "Add member tag"; +"lng_context_edit_member_tag" = "Edit member tag"; "lng_rights_about_add_admins_yes" = "This admin will be able to add new admins with equal or fewer rights."; "lng_rights_about_add_admins_no" = "This admin will not be able to add new admins."; "lng_rights_about_by" = "This admin promoted by {user} on {date}."; @@ -6079,9 +6077,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_rights_group_pin" = "Pin messages"; "lng_rights_group_topics" = "Manage topics"; "lng_rights_group_add_topics" = "Create topics"; +"lng_rights_group_edit_rank" = "Edit own tags"; "lng_rights_group_manage_calls" = "Manage video chats"; "lng_rights_group_delete" = "Delete messages"; "lng_rights_group_anonymous" = "Remain anonymous"; +"lng_rights_group_manage_ranks" = "Edit member tags"; "lng_rights_add_admins" = "Add new admins"; "lng_rights_chat_send_text" = "Send messages"; "lng_rights_chat_send_media" = "Send media"; @@ -6392,11 +6392,13 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_admin_invite_users" = "Add users"; "lng_admin_log_admin_invite_link" = "Invite users via link"; "lng_admin_log_admin_pin_messages" = "Pin messages"; +"lng_admin_log_banned_edit_rank" = "Edit own tags"; "lng_admin_log_admin_manage_topics" = "Manage topics"; "lng_admin_log_admin_create_topics" = "Create topics"; "lng_admin_log_admin_manage_calls" = "Manage video chats"; "lng_admin_log_admin_manage_calls_channel" = "Manage live streams"; "lng_admin_log_admin_manage_direct" = "Manage direct messages"; +"lng_admin_log_admin_manage_ranks" = "Edit member tags"; "lng_admin_log_admin_add_admins" = "Add new admins"; "lng_admin_log_subscription_extend" = "{name} renewed subscription until {date}"; diff --git a/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp b/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp index a2b5af312d..8d042eccfa 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_members_visible.cpp @@ -37,8 +37,7 @@ namespace { const auto min = EnableHideMembersMin(megagroup); const auto showHideMembers = megagroup->canBanMembers() && megagroup->membersCount() >= min; - const auto showCustomTags = megagroup->amCreator(); - if (!showHideMembers && !showCustomTags) { + if (!showHideMembers) { return { nullptr }; } @@ -80,34 +79,5 @@ namespace { }, button->lifetime()); } - if (showCustomTags) { - Ui::AddSkip(container); - const auto tagsButton = container->add( - EditPeerInfoBox::CreateButton( - container, - tr::lng_manage_peer_custom_tags(), - rpl::single(QString()), - [] {}, - st::manageGroupNoIconButton, - {} - ))->toggleOn(rpl::single(megagroup->customRanksEnabled())); - Ui::AddSkip(container); - Ui::AddDividerText( - container, - tr::lng_manage_peer_custom_tags_about()); - - tagsButton->toggledValue( - ) | rpl::on_next([=](bool toggled) { - megagroup->session().api().request( - MTPmessages_ToggleChatCustomRanks( - megagroup->input(), - MTP_bool(toggled) - ) - ).done([=](const MTPUpdates &result) { - megagroup->session().api().applyUpdates(result); - }).send(); - }, tagsButton->lifetime()); - } - return result; } diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 28ad8156ea..dc66c5453c 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1820,25 +1820,13 @@ base::unique_qptr ParticipantsBoxController::rowContextMenu( : &st::menuIconInfo)); } if (user) { - const auto isAdmin = _peer->isChat() - ? (_peer->asChat()->hasAdminRights() - || _peer->asChat()->amCreator()) - : (_peer->isChannel() - ? (_peer->asChannel()->hasAdminRights() - || _peer->asChannel()->amCreator()) - : false); const auto isSelf = user->isSelf(); const auto canEditSelf = isSelf - && (isAdmin - || (_peer->isChat() - ? _peer->asChat()->customRanksEnabled() - : (_peer->isChannel() - ? _peer->asChannel()->customRanksEnabled() - : false))); + && !_peer->amRestricted(ChatRestriction::EditRank); const auto targetIsAdmin = _additional.adminRights(user).has_value() || _additional.isCreator(user); const auto canEditTarget = !isSelf - && isAdmin + && _peer->canManageRanks() && (!targetIsAdmin || _additional.canEditAdmin(user)); if (canEditSelf || canEditTarget) { const auto currentRank = _additional.memberRank(user); diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index df903d6ade..0d48843cd3 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -96,6 +96,7 @@ constexpr auto kDefaultChargeStars = 10; { Flag::AddParticipants, tr::lng_rights_chat_add_members(tr::now) }, { Flag::CreateTopics, tr::lng_rights_group_add_topics(tr::now) }, { Flag::PinMessages, tr::lng_rights_group_pin(tr::now) }, + { Flag::EditRank, tr::lng_rights_group_edit_rank(tr::now) }, { Flag::ChangeInfo, tr::lng_rights_group_info(tr::now) }, }; if (!options.isForum) { @@ -136,6 +137,7 @@ constexpr auto kDefaultChargeStars = 10; }; auto second = std::vector{ { Flag::ManageCall, tr::lng_rights_group_manage_calls(tr::now) }, + { Flag::ManageRanks, tr::lng_rights_group_manage_ranks(tr::now) }, { Flag::Anonymous, tr::lng_rights_group_anonymous(tr::now) }, { Flag::AddAdmins, tr::lng_rights_add_admins(tr::now) }, }; @@ -315,7 +317,8 @@ ChatRestrictions NegateRestrictions(ChatRestrictions value) { | Flag::SendMusic | Flag::SendVoiceMessages | Flag::SendFiles - | Flag::SendOther); + | Flag::SendOther + | Flag::EditRank); } auto Dependencies(ChatAdminRights) diff --git a/Telegram/SourceFiles/boxes/url_auth_box.cpp b/Telegram/SourceFiles/boxes/url_auth_box.cpp index c6e8085199..ec1fd8e6da 100644 --- a/Telegram/SourceFiles/boxes/url_auth_box.cpp +++ b/Telegram/SourceFiles/boxes/url_auth_box.cpp @@ -281,7 +281,8 @@ void RequestButton( inputPeer, MTP_int(itemId.msg), MTP_int(buttonId), - MTPstring() // #TODO auth url + MTPstring(), // #TODO auth url + MTPstring() )).done([=](const MTPUrlAuthResult &result) { const auto accepted = result.match( [](const MTPDurlAuthResultAccepted &data) { @@ -357,7 +358,8 @@ void RequestUrl( MTPInputPeer(), MTPint(), // msg_id MTPint(), // button_id - MTP_string(url) + MTP_string(url), + MTPstring() )).done([=](const MTPUrlAuthResult &result) { const auto accepted = result.match( [](const MTPDurlAuthResultAccepted &data) { diff --git a/Telegram/SourceFiles/data/data_channel.cpp b/Telegram/SourceFiles/data/data_channel.cpp index f3df9e3ab2..a79b0ca10b 100644 --- a/Telegram/SourceFiles/data/data_channel.cpp +++ b/Telegram/SourceFiles/data/data_channel.cpp @@ -712,10 +712,6 @@ bool ChannelData::allowsForwarding() const { return !(flags() & Flag::NoForwards); } -bool ChannelData::customRanksEnabled() const { - return flags() & Flag::CustomRanksEnabled; -} - bool ChannelData::canViewMembers() const { return (flags() & Flag::CanViewParticipants) && (!(flags() & Flag::ParticipantsHidden) diff --git a/Telegram/SourceFiles/data/data_channel.h b/Telegram/SourceFiles/data/data_channel.h index c49e904e16..259900ff60 100644 --- a/Telegram/SourceFiles/data/data_channel.h +++ b/Telegram/SourceFiles/data/data_channel.h @@ -86,7 +86,6 @@ enum class ChannelDataFlag : uint64 { HasStarsPerMessage = (1ULL << 43), StarsPerMessageKnown = (1ULL << 44), HasActiveVideoStream = (1ULL << 45), - CustomRanksEnabled = (1ULL << 46), }; inline constexpr bool is_flag_type(ChannelDataFlag) { return true; }; using ChannelDataFlags = base::flags; @@ -360,8 +359,6 @@ public: [[nodiscard]] bool autoTranslation() const { return flags() & Flag::AutoTranslation; } - [[nodiscard]] bool customRanksEnabled() const; - [[nodiscard]] auto adminRights() const { return _adminRights.current(); } diff --git a/Telegram/SourceFiles/data/data_chat.cpp b/Telegram/SourceFiles/data/data_chat.cpp index 669eac3d10..5105a1b75c 100644 --- a/Telegram/SourceFiles/data/data_chat.cpp +++ b/Telegram/SourceFiles/data/data_chat.cpp @@ -67,10 +67,6 @@ bool ChatData::allowsForwarding() const { return !(flags() & Flag::NoForwards); } -bool ChatData::customRanksEnabled() const { - return flags() & Flag::CustomRanksEnabled; -} - bool ChatData::canEditInformation() const { return amIn() && !amRestricted(ChatRestriction::ChangeInfo); } diff --git a/Telegram/SourceFiles/data/data_chat.h b/Telegram/SourceFiles/data/data_chat.h index d4d5f5f15c..459a29a260 100644 --- a/Telegram/SourceFiles/data/data_chat.h +++ b/Telegram/SourceFiles/data/data_chat.h @@ -23,7 +23,6 @@ enum class ChatDataFlag { CallNotEmpty = (1 << 6), CanSetUsername = (1 << 7), NoForwards = (1 << 8), - CustomRanksEnabled = (1 << 9), }; inline constexpr bool is_flag_type(ChatDataFlag) { return true; }; using ChatDataFlags = base::flags; @@ -100,7 +99,6 @@ public: // Like in ChannelData. [[nodiscard]] bool allowsForwarding() const; - [[nodiscard]] bool customRanksEnabled() const; [[nodiscard]] bool canEditInformation() const; [[nodiscard]] bool canEditPermissions() const; [[nodiscard]] bool canEditUsername() const; diff --git a/Telegram/SourceFiles/data/data_chat_participant_status.cpp b/Telegram/SourceFiles/data/data_chat_participant_status.cpp index 6390f55947..d9b3975d56 100644 --- a/Telegram/SourceFiles/data/data_chat_participant_status.cpp +++ b/Telegram/SourceFiles/data/data_chat_participant_status.cpp @@ -48,6 +48,9 @@ namespace { | (data.is_delete_stories() ? Flag::DeleteStories : Flag()) | (data.is_manage_direct_messages() ? Flag::ManageDirect + : Flag()) + | (data.is_manage_ranks() + ? Flag::ManageRanks : Flag()); }); } @@ -73,7 +76,8 @@ namespace { | (data.is_change_info() ? Flag::ChangeInfo : Flag()) | (data.is_invite_users() ? Flag::AddParticipants : Flag()) | (data.is_pin_messages() ? Flag::PinMessages : Flag()) - | (data.is_manage_topics() ? Flag::CreateTopics : Flag()); + | (data.is_manage_topics() ? Flag::CreateTopics : Flag()) + | (data.is_edit_rank() ? Flag::EditRank : Flag()); }); } @@ -112,6 +116,9 @@ MTPChatAdminRights AdminRightsToMTP(ChatAdminRightsInfo info) { | ((flags & R::DeleteStories) ? Flag::f_delete_stories : Flag()) | ((flags & R::ManageDirect) ? Flag::f_manage_direct_messages + : Flag()) + | ((flags & R::ManageRanks) + ? Flag::f_manage_ranks : Flag()))); } @@ -143,7 +150,8 @@ MTPChatBannedRights RestrictionsToMTP(ChatRestrictionsInfo info) { | ((flags & R::ChangeInfo) ? Flag::f_change_info : Flag()) | ((flags & R::AddParticipants) ? Flag::f_invite_users : Flag()) | ((flags & R::PinMessages) ? Flag::f_pin_messages : Flag()) - | ((flags & R::CreateTopics) ? Flag::f_manage_topics : Flag())), + | ((flags & R::CreateTopics) ? Flag::f_manage_topics : Flag()) + | ((flags & R::EditRank) ? Flag::f_edit_rank : Flag())), MTP_int(info.until)); } diff --git a/Telegram/SourceFiles/data/data_chat_participant_status.h b/Telegram/SourceFiles/data/data_chat_participant_status.h index 073096b09b..4838876201 100644 --- a/Telegram/SourceFiles/data/data_chat_participant_status.h +++ b/Telegram/SourceFiles/data/data_chat_participant_status.h @@ -37,6 +37,7 @@ enum class ChatAdminRight { EditStories = (1 << 15), DeleteStories = (1 << 16), ManageDirect = (1 << 17), + ManageRanks = (1 << 18), }; inline constexpr bool is_flag_type(ChatAdminRight) { return true; } using ChatAdminRights = base::flags; @@ -63,6 +64,7 @@ enum class ChatRestriction { AddParticipants = (1 << 15), PinMessages = (1 << 17), CreateTopics = (1 << 18), + EditRank = (1 << 26), }; inline constexpr bool is_flag_type(ChatRestriction) { return true; } using ChatRestrictions = base::flags; diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 8243d72cc0..d2a12f5695 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -1869,6 +1869,17 @@ bool PeerData::canManageGroupCall() const { Unexpected("Peer type in PeerData::canManageGroupCall."); } +bool PeerData::canManageRanks() const { + if (const auto chat = asChat()) { + return chat->amCreator() + || (chat->adminRights() & ChatAdminRight::ManageRanks); + } else if (const auto channel = asChannel()) { + return channel->amCreator() + || (channel->adminRights() & ChatAdminRight::ManageRanks); + } + return false; +} + bool PeerData::amMonoforumAdmin() const { if (const auto channel = asChannel()) { return channel->flags() & ChannelDataFlag::MonoforumAdmin; diff --git a/Telegram/SourceFiles/data/data_peer.h b/Telegram/SourceFiles/data/data_peer.h index 92623e59cf..5f73007840 100644 --- a/Telegram/SourceFiles/data/data_peer.h +++ b/Telegram/SourceFiles/data/data_peer.h @@ -317,6 +317,7 @@ public: [[nodiscard]] rpl::producer slowmodeAppliedValue() const; [[nodiscard]] int slowmodeSecondsLeft() const; [[nodiscard]] bool canManageGroupCall() const; + [[nodiscard]] bool canManageRanks() const; [[nodiscard]] bool amMonoforumAdmin() const; [[nodiscard]] int starsPerMessage() const; diff --git a/Telegram/SourceFiles/data/data_session.cpp b/Telegram/SourceFiles/data/data_session.cpp index 55622c912a..b34e7770da 100644 --- a/Telegram/SourceFiles/data/data_session.cpp +++ b/Telegram/SourceFiles/data/data_session.cpp @@ -866,8 +866,7 @@ not_null Session::processChat(const MTPChat &data) { | Flag::Forbidden | Flag::CallActive | Flag::CallNotEmpty - | Flag::NoForwards - | Flag::CustomRanksEnabled; + | Flag::NoForwards; const auto flagsSet = (data.is_left() ? Flag::Left : Flag()) | (data.is_creator() ? Flag::Creator : Flag()) | (data.is_deactivated() ? Flag::Deactivated : Flag()) @@ -877,8 +876,7 @@ not_null Session::processChat(const MTPChat &data) { && chat->groupCall()->fullCount() > 0)) ? Flag::CallNotEmpty : Flag()) - | (data.is_noforwards() ? Flag::NoForwards : Flag()) - | (data.is_custom_ranks_enabled() ? Flag::CustomRanksEnabled : Flag()); + | (data.is_noforwards() ? Flag::NoForwards : Flag()); chat->setFlags((chat->flags() & ~flagsMask) | flagsSet); chat->count = data.vparticipants_count().v; @@ -999,8 +997,7 @@ not_null Session::processChat(const MTPChat &data) { | Flag::AutoTranslation | Flag::Monoforum | Flag::HasStarsPerMessage - | Flag::StarsPerMessageKnown - | Flag::CustomRanksEnabled; + | Flag::StarsPerMessageKnown; const auto hasStarsPerMessage = data.vsend_paid_messages_stars().has_value(); if (!hasStarsPerMessage) { @@ -1058,8 +1055,7 @@ not_null Session::processChat(const MTPChat &data) { | (channel->starsPerMessageKnown() ? Flag::StarsPerMessageKnown : Flag())) - : Flag::StarsPerMessageKnown) - | (data.is_custom_ranks_enabled() ? Flag::CustomRanksEnabled : Flag()); + : Flag::StarsPerMessageKnown); channel->setFlags((channel->flags() & ~flagsMask) | flagsSet); channel->setBotVerifyDetailsIcon( data.vbot_verification_icon().value_or_empty()); diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 25b17ea0d4..510d5b5ebd 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -293,6 +293,7 @@ TextWithEntities GenerateAdminChangeText( { Flag::PinMessages, tr::lng_admin_log_admin_pin_messages }, { Flag::ManageCall, tr::lng_admin_log_admin_manage_calls }, { Flag::ManageDirect, tr::lng_admin_log_admin_manage_direct }, + { Flag::ManageRanks, tr::lng_admin_log_admin_manage_ranks }, { Flag::AddAdmins, tr::lng_admin_log_admin_add_admins }, { Flag::Anonymous, tr::lng_admin_log_admin_remain_anonymous }, }; @@ -339,6 +340,7 @@ QString GeneratePermissionsChangeText( { Flag::AddParticipants, tr::lng_admin_log_admin_invite_users }, { Flag::CreateTopics, tr::lng_admin_log_admin_create_topics }, { Flag::PinMessages, tr::lng_admin_log_admin_pin_messages }, + { Flag::EditRank, tr::lng_admin_log_banned_edit_rank }, }; return CollectChanges(phraseMap, prevRights.flags, newRights.flags); } diff --git a/Telegram/SourceFiles/mtproto/scheme/api.tl b/Telegram/SourceFiles/mtproto/scheme/api.tl index b2dfeded0a..60a71517f1 100644 --- a/Telegram/SourceFiles/mtproto/scheme/api.tl +++ b/Telegram/SourceFiles/mtproto/scheme/api.tl @@ -458,7 +458,7 @@ updateStarGiftAuctionUserState#dc58f31e gift_id:long user_state:StarGiftAuctionU updateEmojiGameInfo#fb9c547a info:messages.EmojiGameInfo = Update; updateStarGiftCraftFail#ac072444 = Update; updatePeerHistoryNoForwards#5736b39a flags:# my_enabled:flags.0?true peer_enabled:flags.1?true peer:Peer = Update; -updateChatParticipantRank#33d2633 chat_id:int user_id:int rank:string version:int = Update; +updateChatParticipantRank#bd8367b9 chat_id:long user_id:long rank:string version:int = Update; updates.state#a56c2a3e pts:int qts:int date:int seq:int unread_count:int = updates.State; @@ -1231,9 +1231,9 @@ chatOnlines#f041e250 onlines:int = ChatOnlines; statsURL#47a971e0 url:string = StatsURL; -chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true = ChatAdminRights; +chatAdminRights#5fb224d5 flags:# change_info:flags.0?true post_messages:flags.1?true edit_messages:flags.2?true delete_messages:flags.3?true ban_users:flags.4?true invite_users:flags.5?true pin_messages:flags.7?true add_admins:flags.9?true anonymous:flags.10?true manage_call:flags.11?true other:flags.12?true manage_topics:flags.13?true post_stories:flags.14?true edit_stories:flags.15?true delete_stories:flags.16?true manage_direct_messages:flags.17?true manage_ranks:flags.18?true = ChatAdminRights; -chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true until_date:int = ChatBannedRights; +chatBannedRights#9f120418 flags:# view_messages:flags.0?true send_messages:flags.1?true send_media:flags.2?true send_stickers:flags.3?true send_gifs:flags.4?true send_games:flags.5?true send_inline:flags.6?true embed_links:flags.7?true send_polls:flags.8?true change_info:flags.10?true invite_users:flags.15?true pin_messages:flags.17?true manage_topics:flags.18?true send_photos:flags.19?true send_videos:flags.20?true send_roundvideos:flags.21?true send_audios:flags.22?true send_voices:flags.23?true send_docs:flags.24?true send_plain:flags.25?true edit_rank:flags.26?true until_date:int = ChatBannedRights; inputWallPaper#e630b979 id:long access_hash:long = InputWallPaper; inputWallPaperSlug#72091c80 slug:string = InputWallPaper; @@ -1267,7 +1267,7 @@ folderPeer#e9baa668 peer:Peer folder_id:int = FolderPeer; messages.searchCounter#e844ebff flags:# inexact:flags.1?true filter:MessagesFilter count:int = messages.SearchCounter; -urlAuthResultRequest#32fabf1a flags:# request_write_access:flags.0?true request_phone_number:flags.1?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string = UrlAuthResult; +urlAuthResultRequest#c775e529 flags:# request_write_access:flags.0?true request_phone_number:flags.1?true bot:User domain:string browser:flags.2?string platform:flags.2?string ip:flags.2?string region:flags.2?string match_codes:flags.3?Vector = UrlAuthResult; urlAuthResultAccepted#623a8fa0 flags:# url:flags.0?string = UrlAuthResult; urlAuthResultDefault#a9d6db1f = UrlAuthResult; @@ -2437,7 +2437,7 @@ messages.getEmojiKeywordsLanguages#4e9963b2 lang_codes:Vector = Vector = Vector; messages.requestUrlAuth#198fb446 flags:# peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; -messages.acceptUrlAuth#b12c7125 flags:# write_allowed:flags.0?true share_phone_number:flags.3?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string = UrlAuthResult; +messages.acceptUrlAuth#67a3f0de flags:# write_allowed:flags.0?true share_phone_number:flags.3?true peer:flags.1?InputPeer msg_id:flags.1?int button_id:flags.1?int url:flags.2?string match_code:flags.4?string = UrlAuthResult; messages.hidePeerSettingsBar#4facb138 peer:InputPeer = Bool; messages.getScheduledHistory#f516760b peer:InputPeer hash:long = messages.Messages; messages.getScheduledMessages#bdbb0464 peer:InputPeer id:Vector = messages.Messages; @@ -2570,7 +2570,6 @@ messages.getEmojiGameInfo#fb7e8ca7 = messages.EmojiGameInfo; messages.summarizeText#9d4104e2 flags:# peer:InputPeer id:int to_lang:flags.0?string = TextWithEntities; messages.editChatCreator#f743b857 peer:InputPeer user_id:InputUser password:InputCheckPasswordSRP = Updates; messages.getFutureChatCreatorAfterLeave#3b7d0ea6 peer:InputPeer = User; -messages.toggleChatCustomRanks#341861e6 peer:InputPeer enabled:Bool = Updates; messages.editChatParticipantRank#a00f32b0 peer:InputPeer participant:InputPeer rank:string = Updates; updates.getState#edd4882a = updates.State; diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index 600360a928..73b1db002c 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -3826,13 +3826,6 @@ void FillSenderUserpicMenu( if (const auto user = peer->asUser()) { if (groupPeer) { - const auto isAdmin = groupPeer->isChat() - ? (groupPeer->asChat()->hasAdminRights() - || groupPeer->asChat()->amCreator()) - : (groupPeer->isChannel() - ? (groupPeer->asChannel()->hasAdminRights() - || groupPeer->asChannel()->amCreator()) - : false); const auto canEditTarget = [&] { if (const auto chat = groupPeer->asChat()) { if (peerToUser(user->id) == chat->creator) { @@ -3852,7 +3845,7 @@ void FillSenderUserpicMenu( } return false; }(); - if (isAdmin && canEditTarget && !user->isSelf()) { + if (groupPeer->canManageRanks() && canEditTarget && !user->isSelf()) { const auto currentRank = LookupMemberRank( groupPeer, user);