mirror of https://github.com/procxx/kepka.git
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) {
|
void DialogsInner::notify_historyMuteUpdated(History *history) {
|
||||||
if (!_dialogsImportant || !history->inChatList(Dialogs::Mode::All)) return;
|
if (!_dialogsImportant || !history->inChatList(Dialogs::Mode::All)) return;
|
||||||
|
|
||||||
if (history->mute()) {
|
if (!history->toImportant()) {
|
||||||
if (Global::DialogsMode() == Dialogs::Mode::Important) {
|
if (Global::DialogsMode() == Dialogs::Mode::Important) {
|
||||||
if (_selected && _selected->history() == history) {
|
if (_selected && _selected->history() == history) {
|
||||||
_selected = nullptr;
|
_selected = nullptr;
|
||||||
|
|
|
@ -947,11 +947,17 @@ not_null<HistoryItem*> History::addNewGame(
|
||||||
}
|
}
|
||||||
|
|
||||||
void History::setUnreadMentionsCount(int count) {
|
void History::setUnreadMentionsCount(int count) {
|
||||||
|
const auto had = _unreadMentionsCount && (*_unreadMentionsCount > 0);
|
||||||
if (_unreadMentions.size() > count) {
|
if (_unreadMentions.size() > count) {
|
||||||
LOG(("API Warning: real mentions count is greater than received mentions count"));
|
LOG(("API Warning: real mentions count is greater than received mentions count"));
|
||||||
count = _unreadMentions.size();
|
count = _unreadMentions.size();
|
||||||
}
|
}
|
||||||
_unreadMentionsCount = count;
|
_unreadMentionsCount = count;
|
||||||
|
const auto has = (count > 0);
|
||||||
|
if (has != had && Global::DialogsModeEnabled()) {
|
||||||
|
Notify::historyMuteUpdated(this);
|
||||||
|
updateChatListEntry();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool History::addToUnreadMentions(
|
bool History::addToUnreadMentions(
|
||||||
|
@ -965,8 +971,8 @@ bool History::addToUnreadMentions(
|
||||||
: false;
|
: false;
|
||||||
if (allLoaded) {
|
if (allLoaded) {
|
||||||
if (type == UnreadMentionType::New) {
|
if (type == UnreadMentionType::New) {
|
||||||
++*_unreadMentionsCount;
|
|
||||||
_unreadMentions.insert(msgId);
|
_unreadMentions.insert(msgId);
|
||||||
|
setUnreadMentionsCount(*_unreadMentionsCount + 1);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
} else if (!_unreadMentions.empty() && type != UnreadMentionType::New) {
|
} else if (!_unreadMentions.empty() && type != UnreadMentionType::New) {
|
||||||
|
@ -978,10 +984,8 @@ bool History::addToUnreadMentions(
|
||||||
|
|
||||||
void History::eraseFromUnreadMentions(MsgId msgId) {
|
void History::eraseFromUnreadMentions(MsgId msgId) {
|
||||||
_unreadMentions.remove(msgId);
|
_unreadMentions.remove(msgId);
|
||||||
if (_unreadMentionsCount) {
|
if (_unreadMentionsCount && *_unreadMentionsCount > 0) {
|
||||||
if (*_unreadMentionsCount > 0) {
|
setUnreadMentionsCount(*_unreadMentionsCount - 1);
|
||||||
--*_unreadMentionsCount;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Notify::peerUpdatedDelayed(peer, Notify::PeerUpdate::Flag::UnreadMentionsChanged);
|
Notify::peerUpdatedDelayed(peer, Notify::PeerUpdate::Flag::UnreadMentionsChanged);
|
||||||
}
|
}
|
||||||
|
@ -2362,6 +2366,10 @@ bool History::shouldBeInChatList() const {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool History::toImportant() const {
|
||||||
|
return !mute() || hasUnreadMentions();
|
||||||
|
}
|
||||||
|
|
||||||
void History::unknownMessageDeleted(MsgId messageId) {
|
void History::unknownMessageDeleted(MsgId messageId) {
|
||||||
if (_inboxReadBefore && messageId >= *_inboxReadBefore) {
|
if (_inboxReadBefore && messageId >= *_inboxReadBefore) {
|
||||||
changeUnreadCount(-1);
|
changeUnreadCount(-1);
|
||||||
|
|
|
@ -348,9 +348,7 @@ public:
|
||||||
bool useProxyPromotion() const override;
|
bool useProxyPromotion() const override;
|
||||||
void updateChatListExistence() override;
|
void updateChatListExistence() override;
|
||||||
bool shouldBeInChatList() const override;
|
bool shouldBeInChatList() const override;
|
||||||
bool toImportant() const override {
|
bool toImportant() const override;
|
||||||
return !mute();
|
|
||||||
}
|
|
||||||
int chatListUnreadCount() const override;
|
int chatListUnreadCount() const override;
|
||||||
bool chatListUnreadMark() const override;
|
bool chatListUnreadMark() const override;
|
||||||
bool chatListMutedBadge() const override;
|
bool chatListMutedBadge() const override;
|
||||||
|
|
Loading…
Reference in New Issue