Fix fakeUnreadWhileOpened flag reset.

This commit is contained in:
John Preston 2020-03-23 14:09:27 +04:00
parent aa88ee6d88
commit 6022fa790e
1 changed files with 6 additions and 4 deletions

View File

@ -257,12 +257,14 @@ const rpl::variable<Data::Folder*> &SessionController::openedFolder() const {
}
void SessionController::setActiveChatEntry(Dialogs::RowDescriptor row) {
if (const auto history = _activeChatEntry.current().key.history()) {
history->setFakeUnreadWhileOpened(false);
const auto was = _activeChatEntry.current().key.history();
const auto now = row.key.history();
if (was && was != now) {
was->setFakeUnreadWhileOpened(false);
}
_activeChatEntry = row;
if (const auto history = row.key.history()) {
history->setFakeUnreadWhileOpened(true);
if (now) {
now->setFakeUnreadWhileOpened(true);
}
if (session().supportMode()) {
pushToChatEntryHistory(row);