From 20ba417dddc2788c4f84c31f031354d80079b298 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 6 Nov 2023 12:06:21 +0400 Subject: [PATCH] Fix sending messages from "View as Messages". --- Telegram/SourceFiles/apiwrap.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index 02e3bb9c1b..c3024e991e 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -3580,7 +3580,14 @@ void ApiWrap::sendMessage(MessageToSend &&message) { sendAction(action); const auto clearCloudDraft = action.clearDraft; - const auto topicRootId = action.replyTo.topicRootId; + const auto replyTo = action.replyTo.messageId + ? peer->owner().message(action.replyTo.messageId) + : nullptr; + const auto topicRootId = action.replyTo.topicRootId + ? action.replyTo.topicRootId + : replyTo + ? replyTo->topicRootId() + : Data::ForumTopic::kGeneralId; const auto topic = peer->forumTopicFor(topicRootId); if (!(topic ? Data::CanSendTexts(topic) : Data::CanSendTexts(peer)) || Api::SendDice(message)) {