From 7228752a0110aaf29a23b01e996d653301a720e1 Mon Sep 17 00:00:00 2001 From: John Preston Date: Fri, 4 Feb 2022 19:17:45 +0300 Subject: [PATCH] Check only for existing unread reactions. --- Telegram/SourceFiles/history/history_item.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 09c714aa0..8fb09b7e0 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -180,12 +180,15 @@ MediaCheckResult CheckMessageMedia(const MTPMessageMedia &media) { } using OnStackUsers = std::array; -[[nodiscard]] OnStackUsers LookupRecentReactedUsers( +[[nodiscard]] OnStackUsers LookupRecentUnreadReactedUsers( not_null item) { auto result = OnStackUsers(); auto index = 0; for (const auto &[emoji, reactions] : item->recentReactions()) { for (const auto &reaction : reactions) { + if (!reaction.unread) { + continue; + } if (const auto user = reaction.peer->asUser()) { result[index++] = user; if (index == result.size()) { @@ -907,7 +910,7 @@ void HistoryItem::setReactions(const MTPMessageReactions *reactions) { } void HistoryItem::updateReactions(const MTPMessageReactions *reactions) { - const auto wasRecentUsers = LookupRecentReactedUsers(this); + const auto wasRecentUsers = LookupRecentUnreadReactedUsers(this); const auto hadUnread = hasUnreadReaction(); const auto changed = changeReactions(reactions); if (!changed) {