Added ability to set shortcut for admin log.

This commit is contained in:
23rd
2025-12-28 13:36:55 +03:00
parent fb670b7cdf
commit 926bb91fac
5 changed files with 17 additions and 0 deletions
+1
View File
@@ -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";
+1
View File
@@ -136,6 +136,7 @@ const auto CommandByName = base::flat_map<QString, Command>{
{ 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 },
//
};
+2
View File
@@ -80,6 +80,8 @@ enum class Command {
ShowChatMenu,
ShowChatPreview,
ShowAdminLog,
SupportReloadTemplates,
SupportToggleMuted,
SupportScrollToCurrent,
@@ -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<AdminLog::SectionMemento>(channel));
return true;
});
}
if (session().supportMode()) {
request->check(
Command::SupportToggleMuted
@@ -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() },