From f072173d7ccc03da18d5b436d717d93e4de3ed04 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 2 Feb 2024 09:52:17 +0400 Subject: [PATCH] Fix tags for just-sent Saved Messages. --- Telegram/SourceFiles/history/history_item.cpp | 2 +- Telegram/SourceFiles/history/history_item_helpers.cpp | 7 ++++++- Telegram/SourceFiles/history/history_item_helpers.h | 4 +++- 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index edf39c35c3..15fbde7b52 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -765,7 +765,7 @@ HistoryItem::HistoryItem( : id(id) , _history(history) , _from(from ? history->owner().peer(from) : history->peer) -, _flags(FinalizeMessageFlags(flags)) +, _flags(FinalizeMessageFlags(history, flags)) , _date(date) { if (isHistoryEntry() && IsClientMsgId(id)) { _history->registerClientSideMessage(this); diff --git a/Telegram/SourceFiles/history/history_item_helpers.cpp b/Telegram/SourceFiles/history/history_item_helpers.cpp index 51c1e72a2e..f3aba166ed 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.cpp +++ b/Telegram/SourceFiles/history/history_item_helpers.cpp @@ -624,11 +624,16 @@ std::optional PeerHasThisCall( }); } -[[nodiscard]] MessageFlags FinalizeMessageFlags(MessageFlags flags) { +[[nodiscard]] MessageFlags FinalizeMessageFlags( + not_null history, + MessageFlags flags) { if (!(flags & MessageFlag::FakeHistoryItem) && !(flags & MessageFlag::IsOrWasScheduled) && !(flags & MessageFlag::AdminLogEntry)) { flags |= MessageFlag::HistoryEntry; + if (history->peer->isSelf()) { + flags |= MessageFlag::ReactionsAreTags; + } } return flags; } diff --git a/Telegram/SourceFiles/history/history_item_helpers.h b/Telegram/SourceFiles/history/history_item_helpers.h index 89a3e0a92b..5ebb3f0dec 100644 --- a/Telegram/SourceFiles/history/history_item_helpers.h +++ b/Telegram/SourceFiles/history/history_item_helpers.h @@ -66,7 +66,9 @@ void CheckReactionNotificationSchedule( not_null peer, PeerId from, not_null fwd); -[[nodiscard]] MessageFlags FinalizeMessageFlags(MessageFlags flags); +[[nodiscard]] MessageFlags FinalizeMessageFlags( + not_null history, + MessageFlags flags); [[nodiscard]] bool CopyMarkupToForward(not_null item); [[nodiscard]] TextWithEntities EnsureNonEmpty( const TextWithEntities &text = TextWithEntities());