From 8d0fe601cf1a16eca642de05ffb78c329963ba1e Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 10 Nov 2023 16:25:55 +0400 Subject: [PATCH] Fix sending quote data with uploaded media. Fixes #27032. --- Telegram/SourceFiles/history/history_item.cpp | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 1bd5d52c2..c9391f3fa 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -2904,11 +2904,22 @@ FullStoryId HistoryItem::replyToStory() const { } FullReplyTo HistoryItem::replyTo() const { - return { - .messageId = replyToFullId(), - .storyId = replyToStory(), + auto result = FullReplyTo{ .topicRootId = topicRootId(), }; + if (const auto reply = Get()) { + const auto &fields = reply->fields(); + const auto peer = fields.externalPeerId; + const auto replyToPeer = peer ? peer : _history->peer->id; + if (const auto id = fields.messageId) { + result.messageId = { replyToPeer, id }; + result.quote = fields.quote; + } + if (const auto id = fields.storyId) { + result.storyId = { replyToPeer, id }; + } + } + return result; } void HistoryItem::setText(const TextWithEntities &textWithEntities) {