From a5afeebc0c82023c69ebb123dbd89a30b9ff0073 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 27 Jan 2022 19:02:16 +0300 Subject: [PATCH] Show reaction notification by unread status. --- Telegram/SourceFiles/history/history_item.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Telegram/SourceFiles/history/history_item.cpp b/Telegram/SourceFiles/history/history_item.cpp index 54201c754..cc19f2a1d 100644 --- a/Telegram/SourceFiles/history/history_item.cpp +++ b/Telegram/SourceFiles/history/history_item.cpp @@ -848,18 +848,16 @@ void HistoryItem::updateReactions(const MTPMessageReactions *reactions) { ? history->peer->asUser() : nullptr; const auto toContact = toUser && toUser->isContact(); - const auto maybeNotify = toContact && lookupHisReaction().isEmpty(); const auto hadUnread = hasUnreadReaction(); setReactions(reactions); - const auto hasUnread = _reactions && !_reactions->findUnread().isEmpty(); + const auto unreadReaction = _reactions + ? _reactions->findUnread() + : QString(); + const auto hasUnread = !unreadReaction.isEmpty(); if (hasUnread && !hadUnread) { _flags |= MessageFlag::HasUnreadReaction; addToUnreadThings(HistoryUnreadThings::AddType::New); - } else if (!hasUnread && hadUnread) { - markReactionsRead(); - } - if (maybeNotify) { - if (const auto reaction = lookupHisReaction(); !reaction.isEmpty()) { + if (toContact) { const auto notification = ItemNotification{ this, ItemNotificationType::Reaction, @@ -867,6 +865,8 @@ void HistoryItem::updateReactions(const MTPMessageReactions *reactions) { history->pushNotification(notification); Core::App().notifications().schedule(notification); } + } else if (!hasUnread && hadUnread) { + markReactionsRead(); } }