2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Count unread messages in Dialogs::MainList.

This commit is contained in:
John Preston
2020-03-16 14:20:18 +04:00
parent 9636617798
commit 38a744fe5b
13 changed files with 257 additions and 208 deletions

View File

@@ -1924,12 +1924,16 @@ void History::setFolderPointer(Data::Folder *folder) {
if (isPinnedDialog()) {
owner().setChatPinned(this, false);
}
auto &filters = owner().chatsFilters();
const auto wasKnown = folderKnown();
const auto wasInList = inChatList();
if (wasInList) {
removeFromChatList(0);
for (const auto &filter : owner().chatsFilters().list()) {
removeFromChatList(filter.id());
removeFromChatList(0, owner().chatsList(this->folder()));
for (const auto &filter : filters.list()) {
const auto id = filter.id();
if (inChatList(id)) {
removeFromChatList(id, filters.chatsList(id));
}
}
}
const auto was = _folder.value_or(nullptr);
@@ -1938,10 +1942,11 @@ void History::setFolderPointer(Data::Folder *folder) {
was->unregisterOne(this);
}
if (wasInList) {
addToChatList(0);
for (const auto &filter : owner().chatsFilters().list()) {
addToChatList(0, owner().chatsList(folder));
for (const auto &filter : filters.list()) {
if (filter.contains(this)) {
addToChatList(filter.id());
const auto id = filter.id();
addToChatList(id, filters.chatsList(id));
}
}
owner().chatsListChanged(was);