mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Show reaction notification by unread status.
This commit is contained in:
parent
9903266722
commit
a5afeebc0c
1 changed files with 7 additions and 7 deletions
|
@ -848,18 +848,16 @@ void HistoryItem::updateReactions(const MTPMessageReactions *reactions) {
|
||||||
? history->peer->asUser()
|
? history->peer->asUser()
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto toContact = toUser && toUser->isContact();
|
const auto toContact = toUser && toUser->isContact();
|
||||||
const auto maybeNotify = toContact && lookupHisReaction().isEmpty();
|
|
||||||
const auto hadUnread = hasUnreadReaction();
|
const auto hadUnread = hasUnreadReaction();
|
||||||
setReactions(reactions);
|
setReactions(reactions);
|
||||||
const auto hasUnread = _reactions && !_reactions->findUnread().isEmpty();
|
const auto unreadReaction = _reactions
|
||||||
|
? _reactions->findUnread()
|
||||||
|
: QString();
|
||||||
|
const auto hasUnread = !unreadReaction.isEmpty();
|
||||||
if (hasUnread && !hadUnread) {
|
if (hasUnread && !hadUnread) {
|
||||||
_flags |= MessageFlag::HasUnreadReaction;
|
_flags |= MessageFlag::HasUnreadReaction;
|
||||||
addToUnreadThings(HistoryUnreadThings::AddType::New);
|
addToUnreadThings(HistoryUnreadThings::AddType::New);
|
||||||
} else if (!hasUnread && hadUnread) {
|
if (toContact) {
|
||||||
markReactionsRead();
|
|
||||||
}
|
|
||||||
if (maybeNotify) {
|
|
||||||
if (const auto reaction = lookupHisReaction(); !reaction.isEmpty()) {
|
|
||||||
const auto notification = ItemNotification{
|
const auto notification = ItemNotification{
|
||||||
this,
|
this,
|
||||||
ItemNotificationType::Reaction,
|
ItemNotificationType::Reaction,
|
||||||
|
@ -867,6 +865,8 @@ void HistoryItem::updateReactions(const MTPMessageReactions *reactions) {
|
||||||
history->pushNotification(notification);
|
history->pushNotification(notification);
|
||||||
Core::App().notifications().schedule(notification);
|
Core::App().notifications().schedule(notification);
|
||||||
}
|
}
|
||||||
|
} else if (!hasUnread && hadUnread) {
|
||||||
|
markReactionsRead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue