From 5350c97f8297b7b88b2adc681d378e34de512ef8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Nov 2023 12:31:59 +0400 Subject: [PATCH] Fix sending replies in forums. --- Telegram/SourceFiles/data/data_histories.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index e1fd60f6fd..0f252aa531 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -48,14 +48,17 @@ MTPInputReplyTo ReplyToForMTP( } } else if (replyTo.messageId || replyTo.topicRootId) { const auto to = LookupReplyTo(history, replyTo.messageId); + const auto replyingToTopic = replyTo.topicRootId + ? history->peer->forumTopicFor(replyTo.topicRootId) + : nullptr; const auto replyingToTopicId = replyTo.topicRootId - ? replyTo.topicRootId - : Data::ForumTopic::kGeneralId; - const auto replyToTopicId = !to - ? replyingToTopicId - : to->topicRootId() + ? (replyingToTopic + ? replyingToTopic->rootId() + : Data::ForumTopic::kGeneralId) + : (to ? to->topicRootId() : Data::ForumTopic::kGeneralId); + const auto replyToTopicId = to ? to->topicRootId() - : Data::ForumTopic::kGeneralId; + : replyingToTopicId; const auto external = replyTo.messageId && (replyTo.messageId.peer != history->peer->id || replyingToTopicId != replyToTopicId);