diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 61098e2c03..2d6174a667 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -709,6 +709,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_shortcuts_show_chat_preview" = "Show chat preview"; "lng_shortcuts_record_voice_message" = "Record Voice Message"; "lng_shortcuts_record_round_message" = "Record Round Message"; +"lng_shortcuts_admin_log" = "Group/Channel Recent Actions"; "lng_settings_chat_reactions_title" = "Quick Reaction"; "lng_settings_chat_reactions_subtitle" = "Choose your favorite reaction"; diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index fe12804c08..09f07e2d5b 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -136,6 +136,7 @@ const auto CommandByName = base::flat_map{ { u"show_scheduled"_q , Command::ShowScheduled }, { u"archive_chat"_q , Command::ArchiveChat }, { u"record_round"_q , Command::RecordRound }, + { u"show_admin_log"_q , Command::ShowAdminLog }, // }; diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index dffb31ec63..ff59b47658 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -80,6 +80,8 @@ enum class Command { ShowChatMenu, ShowChatPreview, + ShowAdminLog, + SupportReloadTemplates, SupportToggleMuted, SupportScrollToCurrent, diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index bcbdaad903..d6deefed37 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -95,6 +95,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "history/history_inner_widget.h" #include "history/history_item_components.h" #include "history/history_unread_things.h" +#include "history/admin_log/history_admin_log_section.h" #include "history/view/controls/history_view_characters_limit.h" #include "history/view/controls/history_view_compose_search.h" #include "history/view/controls/history_view_forward_panel.h" @@ -2149,6 +2150,16 @@ void HistoryWidget::setupShortcuts() { return false; }); } + const auto channel = _peer ? _peer->asChannel() : nullptr; + const auto hasRecentActions = channel + && (channel->hasAdminRights() || channel->amCreator()); + if (hasRecentActions) { + request->check(Command::ShowAdminLog, 1) && request->handle([=] { + controller()->showSection( + std::make_shared(channel)); + return true; + }); + } if (session().supportMode()) { request->check( Command::SupportToggleMuted diff --git a/Telegram/SourceFiles/settings/settings_shortcuts.cpp b/Telegram/SourceFiles/settings/settings_shortcuts.cpp index 88c7c2c095..6a38f972e8 100644 --- a/Telegram/SourceFiles/settings/settings_shortcuts.cpp +++ b/Telegram/SourceFiles/settings/settings_shortcuts.cpp @@ -107,6 +107,8 @@ struct Labeled { { C::RecordVoice, tr::lng_shortcuts_record_voice_message() }, { C::RecordRound, tr::lng_shortcuts_record_round_message() }, separator, + { C::ShowAdminLog, tr::lng_shortcuts_admin_log() }, + separator, { C::MediaViewerFullscreen, tr::lng_shortcuts_media_fullscreen() }, separator, { C::MediaPlay, tr::lng_shortcuts_media_play() },