diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp index 20814f3ea..4e50b2bf6 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_inner_widget.cpp @@ -730,6 +730,9 @@ void InnerWidget::fill() { inner, [=](RecentPostId id) { _showRequests.fire({ + .info = (!id.messageId && !id.storyId) + ? id.messageId.peer + : PeerId(0), .history = id.messageId, .story = id.storyId, }); diff --git a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp index acead54d5..1a975b788 100644 --- a/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp +++ b/Telegram/SourceFiles/info/statistics/info_statistics_list_controllers.cpp @@ -23,9 +23,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "ui/rect.h" #include "ui/vertical_list.h" #include "ui/widgets/buttons.h" +#include "ui/widgets/popup_menu.h" #include "ui/wrap/slide_wrap.h" #include "ui/wrap/vertical_layout.h" #include "styles/style_dialogs.h" // dialogsStoriesFull. +#include "styles/style_menu_icons.h" #include "styles/style_settings.h" #include "styles/style_statistics.h" #include "styles/style_window.h" @@ -274,6 +276,9 @@ public: void prepare() override; void rowClicked(not_null row) override; void loadMoreRows() override; + base::unique_qptr rowContextMenu( + QWidget *parent, + not_null row) override; private: void appendRow(not_null peer, Data::RecentPostId contextId); @@ -339,6 +344,29 @@ void PublicForwardsController::rowClicked(not_null row) { crl::on_main([=, id = rowWithId->contextId()] { _requestShow(id); }); } +base::unique_qptr PublicForwardsController::rowContextMenu( + QWidget *parent, + not_null row) { + auto menu = base::make_unique_q( + parent, + st::popupMenuWithIcons); + const auto peer = row->peer(); + const auto text = (peer->isChat() || peer->isMegagroup()) + ? tr::lng_context_view_group(tr::now) + : peer->isUser() + ? tr::lng_context_view_profile(tr::now) + : peer->isChannel() + ? tr::lng_context_view_channel(tr::now) + : QString(); + if (text.isEmpty()) { + return nullptr; + } + menu->addAction(text, crl::guard(parent, [=, peerId = peer->id] { + _requestShow({ .messageId = { peerId, MsgId() } }); + }), peer->isUser() ? &st::menuIconProfile : &st::menuIconInfo); + return menu; +} + void PublicForwardsController::appendRow( not_null peer, Data::RecentPostId contextId) {