Fix tags for just-sent Saved Messages.

This commit is contained in:
John Preston 2024-02-02 09:52:17 +04:00
parent bec34c34b1
commit f072173d7c
3 changed files with 10 additions and 3 deletions

View file

@ -765,7 +765,7 @@ HistoryItem::HistoryItem(
: id(id) : id(id)
, _history(history) , _history(history)
, _from(from ? history->owner().peer(from) : history->peer) , _from(from ? history->owner().peer(from) : history->peer)
, _flags(FinalizeMessageFlags(flags)) , _flags(FinalizeMessageFlags(history, flags))
, _date(date) { , _date(date) {
if (isHistoryEntry() && IsClientMsgId(id)) { if (isHistoryEntry() && IsClientMsgId(id)) {
_history->registerClientSideMessage(this); _history->registerClientSideMessage(this);

View file

@ -624,11 +624,16 @@ std::optional<bool> PeerHasThisCall(
}); });
} }
[[nodiscard]] MessageFlags FinalizeMessageFlags(MessageFlags flags) { [[nodiscard]] MessageFlags FinalizeMessageFlags(
not_null<History*> history,
MessageFlags flags) {
if (!(flags & MessageFlag::FakeHistoryItem) if (!(flags & MessageFlag::FakeHistoryItem)
&& !(flags & MessageFlag::IsOrWasScheduled) && !(flags & MessageFlag::IsOrWasScheduled)
&& !(flags & MessageFlag::AdminLogEntry)) { && !(flags & MessageFlag::AdminLogEntry)) {
flags |= MessageFlag::HistoryEntry; flags |= MessageFlag::HistoryEntry;
if (history->peer->isSelf()) {
flags |= MessageFlag::ReactionsAreTags;
}
} }
return flags; return flags;
} }

View file

@ -66,7 +66,9 @@ void CheckReactionNotificationSchedule(
not_null<PeerData*> peer, not_null<PeerData*> peer,
PeerId from, PeerId from,
not_null<HistoryItem*> fwd); not_null<HistoryItem*> fwd);
[[nodiscard]] MessageFlags FinalizeMessageFlags(MessageFlags flags); [[nodiscard]] MessageFlags FinalizeMessageFlags(
not_null<History*> history,
MessageFlags flags);
[[nodiscard]] bool CopyMarkupToForward(not_null<const HistoryItem*> item); [[nodiscard]] bool CopyMarkupToForward(not_null<const HistoryItem*> item);
[[nodiscard]] TextWithEntities EnsureNonEmpty( [[nodiscard]] TextWithEntities EnsureNonEmpty(
const TextWithEntities &text = TextWithEntities()); const TextWithEntities &text = TextWithEntities());