diff --git a/Telegram/SourceFiles/core/shortcuts.cpp b/Telegram/SourceFiles/core/shortcuts.cpp index 04a251017..b47563311 100644 --- a/Telegram/SourceFiles/core/shortcuts.cpp +++ b/Telegram/SourceFiles/core/shortcuts.cpp @@ -106,6 +106,7 @@ const auto CommandByName = base::flat_map{ { u"message_scheduled"_q , Command::ScheduleMessage }, { u"media_viewer_video_fullscreen"_q , Command::MediaViewerFullscreen }, { u"show_scheduled"_q , Command::ShowScheduled }, + { u"archive_chat"_q , Command::ArchiveChat }, // }; diff --git a/Telegram/SourceFiles/core/shortcuts.h b/Telegram/SourceFiles/core/shortcuts.h index 0472c1be8..562c54e44 100644 --- a/Telegram/SourceFiles/core/shortcuts.h +++ b/Telegram/SourceFiles/core/shortcuts.h @@ -67,6 +67,7 @@ enum class Command { ScheduleMessage, ReadChat, + ArchiveChat, MediaViewerFullscreen, diff --git a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp index dab3e303a..354a148eb 100644 --- a/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp +++ b/Telegram/SourceFiles/dialogs/dialogs_inner_widget.cpp @@ -4011,6 +4011,24 @@ void InnerWidget::setupShortcuts() { return true; }); + (!_openedForum) + && request->check(Command::ArchiveChat) + && request->handle([=] { + const auto thread = _selected ? _selected->thread() : nullptr; + if (!thread) { + return false; + } + const auto history = thread->owningHistory(); + const auto isArchived = history->folder() + && (history->folder()->id() == Data::Folder::kId); + + Window::ToggleHistoryArchived( + _controller->uiShow(), + history, + !isArchived); + return true; + }); + request->check(Command::ShowContacts) && request->handle([=] { _controller->show(PrepareContactsBox(_controller)); return true;