diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 66fccd0a93..3e39a37cbf 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -89,6 +89,8 @@ const auto CommandByName = base::flat_map{ { qsl("show_archive") , Command::ShowArchive }, + { qsl("read_chat") , Command::ReadChat }, + // Shortcuts that have no default values. { qsl("message") , Command::JustSendMessage }, { qsl("message_silently") , Command::SendSilentMessage }, @@ -130,6 +132,8 @@ const auto CommandNames = base::flat_map{ { Command::ShowFolderLast , qsl("last_folder") }, { Command::ShowArchive , qsl("show_archive") }, + + { Command::ReadChat , qsl("read_chat") }, }; class Manager { @@ -379,6 +383,8 @@ void Manager::fillDefaults() { set(qsl("ctrl+0"), Command::ChatSelf); set(qsl("ctrl+9"), Command::ShowArchive); + + set(qsl("ctrl+r"), Command::ReadChat); } void Manager::writeDefaultFile() { diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 4bdf9bca44..c64877dca5 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -53,6 +53,8 @@ enum class Command { SendSilentMessage, ScheduleMessage, + ReadChat, + SupportReloadTemplates, SupportToggleMuted, SupportScrollToCurrent, diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index 5e266b7cf6..f978ecbe57 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -3166,6 +3166,18 @@ void InnerWidget::setupShortcuts() { return nearFolder(false); }); + request->check(Command::ReadChat) && request->handle([=] { + const auto history = _selected ? _selected->history() : nullptr; + if (history) { + if ((history->chatListUnreadCount() > 0) + || history->chatListUnreadMark()) { + session().data().histories().readInbox(history); + } + return true; + } + return (history != nullptr); + }); + if (session().supportMode() && row.key.history()) { request->check( Command::SupportScrollToCurrent