From 9276f3dab88e42f226ad972d7d135e78d64d4193 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 7 Nov 2022 15:44:37 +0400 Subject: [PATCH] Fix reply button in View as Messages. --- .../history/view/history_view_message.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/history/view/history_view_message.cpp b/Telegram/SourceFiles/history/view/history_view_message.cpp index ae90a0bc1..5f0938895 100644 --- a/Telegram/SourceFiles/history/view/history_view_message.cpp +++ b/Telegram/SourceFiles/history/view/history_view_message.cpp @@ -31,6 +31,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "data/data_session.h" #include "data/data_user.h" #include "data/data_channel.h" +#include "data/data_forum_topic.h" #include "data/data_message_reactions.h" #include "data/data_sponsored_messages.h" #include "lang/lang_keys.h" @@ -2707,9 +2708,21 @@ bool Message::hasFastReply() const { } bool Message::displayFastReply() const { + const auto canWrite = [&] { + const auto item = data(); + const auto peer = item->history()->peer; + if (peer->isForum()) { + const auto topic = item->topic(); + return topic + ? topic->canWrite() + : peer->canWrite(!item->topicRootId()); + } + return peer->canWrite(); + }; + return hasFastReply() && data()->isRegular() - && data()->history()->peer->canWrite(false) + && canWrite() && !delegate()->elementInSelectionMode(); }