Force zero unread count if read till end.

This commit is contained in:
John Preston 2020-02-24 14:53:38 +04:00
parent f2ef109940
commit c3463dec63
1 changed files with 11 additions and 0 deletions

View File

@ -135,6 +135,17 @@ void Histories::readInboxTill(
bool force) {
Expects(IsServerMsgId(tillId) || (!tillId && !force));
const auto syncGuard = gsl::finally([&] {
if (history->unreadCount() > 0) {
if (const auto last = history->lastServerMessage()) {
if (last->id == tillId) {
history->setUnreadCount(0);
history->updateChatListEntry();
}
}
}
});
history->session().notifications().clearIncomingFromHistory(history);
const auto needsRequest = history->readInboxTillNeedsRequest(tillId);