Clear fake-unread status when switching folders.

This commit is contained in:
John Preston 2020-05-12 12:18:52 +04:00
parent c7878f9d21
commit f4f6550d66
2 changed files with 13 additions and 0 deletions

View File

@ -242,6 +242,9 @@ bool SessionController::uniqueChatsInSearchResults() const {
}
void SessionController::openFolder(not_null<Data::Folder*> folder) {
if (_openedFolder.current() != folder) {
resetFakeUnreadWhileOpened();
}
setActiveChatsFilter(0);
_openedFolder = folder.get();
}
@ -269,6 +272,12 @@ void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
}
}
void SessionController::resetFakeUnreadWhileOpened() {
if (const auto history = _activeChatEntry.current().key.history()) {
history->setFakeUnreadWhileOpened(false);
}
}
bool SessionController::chatEntryHistoryMove(int steps) {
if (_chatEntryHistory.empty()) {
return false;
@ -781,6 +790,9 @@ FilterId SessionController::activeChatsFilterCurrent() const {
}
void SessionController::setActiveChatsFilter(FilterId id) {
if (activeChatsFilterCurrent() != id) {
resetFakeUnreadWhileOpened();
}
_activeChatsFilter.force_assign(id);
if (id) {
closeFolder();

View File

@ -328,6 +328,7 @@ private:
void pushToChatEntryHistory(Dialogs::RowDescriptor row);
bool chatEntryHistoryMove(int steps);
void resetFakeUnreadWhileOpened();
const not_null<Controller*> _window;