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)
, _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);

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)
&& !(flags & MessageFlag::IsOrWasScheduled)
&& !(flags & MessageFlag::AdminLogEntry)) {
flags |= MessageFlag::HistoryEntry;
if (history->peer->isSelf()) {
flags |= MessageFlag::ReactionsAreTags;
}
}
return flags;
}

View File

@ -66,7 +66,9 @@ void CheckReactionNotificationSchedule(
not_null<PeerData*> peer,
PeerId from,
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]] TextWithEntities EnsureNonEmpty(
const TextWithEntities &text = TextWithEntities());