diff --git a/Telegram/SourceFiles/history/history_inner_widget.cpp b/Telegram/SourceFiles/history/history_inner_widget.cpp index 73033ce997..08ba47a0e0 100644 --- a/Telegram/SourceFiles/history/history_inner_widget.cpp +++ b/Telegram/SourceFiles/history/history_inner_widget.cpp @@ -2097,16 +2097,30 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) { } const auto repliesCount = item->repliesCount(); const auto withReplies = (repliesCount > 0); - if (withReplies && item->history()->peer->isMegagroup()) { - const auto rootId = repliesCount ? item->id : item->replyToTop(); - const auto phrase = (repliesCount > 0) + const auto topicRootId = item->history()->peer->isForum() + ? item->topicRootId() + : 0; + if (topicRootId + || (withReplies && item->history()->peer->isMegagroup())) { + const auto highlightId = topicRootId ? item->id : 0; + const auto rootId = topicRootId + ? topicRootId + : repliesCount + ? item->id + : item->replyToTop(); + const auto phrase = topicRootId + ? u"View in Thread"_q // #TODO lang-forum + : (repliesCount > 0) ? tr::lng_replies_view( tr::now, lt_count, repliesCount) : tr::lng_replies_view_thread(tr::now); _menu->addAction(phrase, [=] { - controller->showRepliesForMessage(_history, rootId); + controller->showRepliesForMessage( + _history, + rootId, + highlightId); }, &st::menuIconViewReplies); } const auto t = base::unixtime::now(); diff --git a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp index 07c2630bcf..2f611d3725 100644 --- a/Telegram/SourceFiles/history/view/history_view_context_menu.cpp +++ b/Telegram/SourceFiles/history/view/history_view_context_menu.cpp @@ -616,13 +616,25 @@ bool AddViewRepliesAction( || (context != Context::History && context != Context::Pinned)) { return false; } + const auto topicRootId = item->history()->peer->isForum() + ? item->topicRootId() + : 0; const auto repliesCount = item->repliesCount(); const auto withReplies = (repliesCount > 0); if (!withReplies || !item->history()->peer->isMegagroup()) { - return false; + if (!topicRootId) { + return false; + } } - const auto rootId = repliesCount ? item->id : item->replyToTop(); - const auto phrase = (repliesCount > 0) + const auto rootId = topicRootId + ? topicRootId + : repliesCount + ? item->id + : item->replyToTop(); + const auto highlightId = topicRootId ? item->id : 0; + const auto phrase = topicRootId + ? u"View in Thread"_q // #TODO lang-forum + : (repliesCount > 0) ? tr::lng_replies_view( tr::now, lt_count, @@ -631,7 +643,10 @@ bool AddViewRepliesAction( const auto controller = list->controller(); const auto history = item->history(); menu->addAction(phrase, crl::guard(controller, [=] { - controller->showRepliesForMessage(history, rootId); + controller->showRepliesForMessage( + history, + rootId, + highlightId); }), &st::menuIconViewReplies); return true; }