2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Version 1.5.2: Fix unread mentions in workmode.

This commit is contained in:
John Preston
2018-12-13 16:31:03 +04:00
parent 4836173fe6
commit 0f67f75bed
3 changed files with 15 additions and 9 deletions

View File

@@ -947,11 +947,17 @@ not_null<HistoryItem*> History::addNewGame(
}
void History::setUnreadMentionsCount(int count) {
const auto had = _unreadMentionsCount && (*_unreadMentionsCount > 0);
if (_unreadMentions.size() > count) {
LOG(("API Warning: real mentions count is greater than received mentions count"));
count = _unreadMentions.size();
}
_unreadMentionsCount = count;
const auto has = (count > 0);
if (has != had && Global::DialogsModeEnabled()) {
Notify::historyMuteUpdated(this);
updateChatListEntry();
}
}
bool History::addToUnreadMentions(
@@ -965,8 +971,8 @@ bool History::addToUnreadMentions(
: false;
if (allLoaded) {
if (type == UnreadMentionType::New) {
++*_unreadMentionsCount;
_unreadMentions.insert(msgId);
setUnreadMentionsCount(*_unreadMentionsCount + 1);
return true;
}
} else if (!_unreadMentions.empty() && type != UnreadMentionType::New) {
@@ -978,10 +984,8 @@ bool History::addToUnreadMentions(
void History::eraseFromUnreadMentions(MsgId msgId) {
_unreadMentions.remove(msgId);
if (_unreadMentionsCount) {
if (*_unreadMentionsCount > 0) {
--*_unreadMentionsCount;
}
if (_unreadMentionsCount && *_unreadMentionsCount > 0) {
setUnreadMentionsCount(*_unreadMentionsCount - 1);
}
Notify::peerUpdatedDelayed(peer, Notify::PeerUpdate::Flag::UnreadMentionsChanged);
}
@@ -2362,6 +2366,10 @@ bool History::shouldBeInChatList() const {
return true;
}
bool History::toImportant() const {
return !mute() || hasUnreadMentions();
}
void History::unknownMessageDeleted(MsgId messageId) {
if (_inboxReadBefore && messageId >= *_inboxReadBefore) {
changeUnreadCount(-1);