mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-28 01:23:09 +00:00
Version 1.5.2: Fix unread mentions in workmode.
This commit is contained in:
parent
4836173fe6
commit
0f67f75bed
@ -2031,7 +2031,7 @@ void DialogsInner::userIsContactUpdated(not_null<UserData*> user) {
|
||||
void DialogsInner::notify_historyMuteUpdated(History *history) {
|
||||
if (!_dialogsImportant || !history->inChatList(Dialogs::Mode::All)) return;
|
||||
|
||||
if (history->mute()) {
|
||||
if (!history->toImportant()) {
|
||||
if (Global::DialogsMode() == Dialogs::Mode::Important) {
|
||||
if (_selected && _selected->history() == history) {
|
||||
_selected = nullptr;
|
||||
|
@ -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);
|
||||
|
@ -348,9 +348,7 @@ public:
|
||||
bool useProxyPromotion() const override;
|
||||
void updateChatListExistence() override;
|
||||
bool shouldBeInChatList() const override;
|
||||
bool toImportant() const override {
|
||||
return !mute();
|
||||
}
|
||||
bool toImportant() const override;
|
||||
int chatListUnreadCount() const override;
|
||||
bool chatListUnreadMark() const override;
|
||||
bool chatListMutedBadge() const override;
|
||||
|
Loading…
Reference in New Issue
Block a user