diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b6701988b..82e5dfb68 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3349,6 +3349,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_context_promote_admin" = "Promote to admin"; "lng_context_edit_permissions" = "Edit permissions"; "lng_context_restrict_user" = "Restrict user"; +"lng_context_ban_user" = "Ban"; "lng_context_remove_from_group" = "Remove from group"; "lng_context_add_to_group" = "Add to group"; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp index 08631701f..a53de982a 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_inner.cpp @@ -39,6 +39,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/chat/chat_style.h" #include "ui/widgets/checkbox.h" #include "ui/widgets/expandable_peer_list.h" +#include "ui/widgets/menu/menu_add_action_callback_factory.h" +#include "ui/widgets/menu/menu_add_action_callback.h" #include "ui/widgets/popup_menu.h" #include "ui/image/image.h" #include "ui/text/text_utilities.h" @@ -52,6 +54,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "lang/lang_keys.h" #include "boxes/peers/edit_participant_box.h" #include "boxes/peers/edit_participants_box.h" +#include "data/data_changes.h" #include "data/data_session.h" #include "data/data_photo.h" #include "data/data_photo_media.h" @@ -1564,6 +1567,30 @@ void InnerWidget::suggestRestrictParticipant( }).send(); } }, &st::menuIconPermissions); + + { + const auto lifetime = std::make_shared(); + auto handler = [=, this] { + participant->session().changes().peerUpdates( + _channel, + Data::PeerUpdate::Flag::Members + ) | rpl::start_with_next([=](const Data::PeerUpdate &update) { + _downLoaded = false; + preloadMore(Direction::Down); + lifetime->destroy(); + }, *lifetime); + participant->session().api().chatParticipants().kick( + _channel, + participant, + { _channel->restrictions(), 0 }); + }; + Ui::Menu::CreateAddActionCallback(_menu)({ + .text = tr::lng_context_ban_user(tr::now), + .handler = std::move(handler), + .icon = &st::menuIconBlockAttention, + .isAttention = true, + }); + } } void InnerWidget::restrictParticipant( diff --git a/Telegram/SourceFiles/ui/menu_icons.style b/Telegram/SourceFiles/ui/menu_icons.style index ebe25e46b..80a9ed4ad 100644 --- a/Telegram/SourceFiles/ui/menu_icons.style +++ b/Telegram/SourceFiles/ui/menu_icons.style @@ -203,6 +203,7 @@ menuIconReportAttention: icon {{ "menu/report", menuIconAttentionColor }}; menuIconRestoreAttention: icon {{ "menu/restore", menuIconAttentionColor }}; menuIconTagRemoveAttention: icon {{ "menu/tag_remove", menuIconAttentionColor }}; menuIconCancelAttention: icon {{ "menu/cancel", menuIconAttentionColor }}; +menuIconBlockAttention: icon {{ "menu/block", menuIconAttentionColor }}; menuIconBlockSettings: icon {{ "menu/block", windowBgActive }}; menuIconInviteSettings: icon {{ "menu/invite", windowBgActive }};