From b0bb8b05fd746e449c959a338e5b98e99553f947 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 6 Dec 2022 22:52:04 +0400 Subject: [PATCH] Fix reply from notification replyTo field value. --- Telegram/SourceFiles/window/notifications_manager.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 8e2899003..3c7e1e2d3 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -1073,12 +1073,18 @@ void Manager::notificationReplied( const auto history = session->data().history(id.contextId.peerId); const auto item = history->owner().message(history->peer, id.msgId); const auto topic = item ? item->topic() : nullptr; + const auto topicRootId = topic + ? topic->rootId() + : id.contextId.topicRootId; auto message = Api::MessageToSend(Api::SendAction(history)); message.textWithTags = reply; - message.action.replyTo = (id.msgId > 0 && !history->peer->isUser()) + message.action.replyTo = (id.msgId > 0 && !history->peer->isUser() + && id.msgId != topicRootId) ? id.msgId - : id.contextId.topicRootId; + : history->peer->isForum() + ? topicRootId + : MsgId(0); message.action.topicRootId = topic ? topic->rootId() : 0; message.action.clearDraft = false; history->session().api().sendMessage(std::move(message));