From 2d3e2b1ef87dcccab90e4fdc5ff9b26005ca4d84 Mon Sep 17 00:00:00 2001 From: John Preston Date: Tue, 24 Oct 2023 13:10:17 +0400 Subject: [PATCH] Fix drafts in topics. --- Telegram/SourceFiles/data/data_histories.cpp | 7 +++---- Telegram/SourceFiles/history/history.cpp | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/data/data_histories.cpp b/Telegram/SourceFiles/data/data_histories.cpp index 9b6f55655..fb20655a5 100644 --- a/Telegram/SourceFiles/data/data_histories.cpp +++ b/Telegram/SourceFiles/data/data_histories.cpp @@ -46,7 +46,8 @@ MTPInputReplyTo ReplyToForMTP( } } } else if (replyTo.messageId || replyTo.topicRootId) { - const auto external = (replyTo.messageId.peer != history->peer->id); + const auto external = replyTo.messageId + && (replyTo.messageId.peer != history->peer->id); const auto quoteEntities = Api::EntitiesToMTP( &history->session(), replyTo.quote.entities, @@ -61,9 +62,7 @@ MTPInputReplyTo ReplyToForMTP( | (quoteEntities.v.isEmpty() ? Flag() : Flag::f_quote_entities)), - MTP_int(replyTo.messageId - ? replyTo.messageId.msg - : replyTo.topicRootId), + MTP_int(replyTo.messageId ? replyTo.messageId.msg : 0), MTP_int(replyTo.topicRootId), (external ? owner->peer(replyTo.messageId.peer)->input diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 1ab97d502..e5c03f37d 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -275,7 +275,7 @@ Data::Draft *History::createCloudDraft( if (Data::DraftIsNull(fromDraft)) { setCloudDraft(std::make_unique( TextWithTags(), - FullReplyTo(), + FullReplyTo{ .topicRootId = topicRootId }, MessageCursor(), Data::WebPageDraft())); cloudDraft(topicRootId)->date = TimeId(0);