From 25b5027dc7916d1236a25993424c58370dba5e42 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 31 Jan 2019 15:20:15 +0300 Subject: [PATCH] Only creator can restrict in old groups. --- .../SourceFiles/boxes/peers/edit_participants_box.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp index 491717754..6a68e10af 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_participants_box.cpp @@ -1377,13 +1377,19 @@ base::unique_qptr ParticipantsBoxController::rowContextMenu( crl::guard(this, [=] { showAdmin(user); })); } if (_additional.canRestrictUser(user)) { - const auto isGroup = _peer->isChat() || _peer->isMegagroup(); - if (isGroup) { + const auto canRestrictWithoutKick = [&] { + if (const auto chat = _peer->asChat()) { + return chat->amCreator(); + } + return _peer->isMegagroup(); + }(); + if (canRestrictWithoutKick) { result->addAction( lang(lng_context_restrict_user), crl::guard(this, [=] { showRestricted(user); })); } if (!_additional.isKicked(user)) { + const auto isGroup = _peer->isChat() || _peer->isMegagroup(); result->addAction( lang(isGroup ? lng_context_remove_from_group