diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index cf54157323..dfd506a0da 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -6001,6 +6001,11 @@ void ApiWrap::sendReadRequest(not_null peer, MsgId upTo) { _readRequests.remove(peer); if (const auto next = _readRequestsPending.take(peer)) { sendReadRequest(peer, *next); + } else if (const auto history + = _session->data().historyLoaded(peer)) { + if (!history->unreadCountKnown()) { + requestDialogEntry(history); + } } }; if (const auto channel = peer->asChannel()) { diff --git a/Telegram/SourceFiles/history/history.cpp b/Telegram/SourceFiles/history/history.cpp index 747c23c9e3..e5b701f69a 100644 --- a/Telegram/SourceFiles/history/history.cpp +++ b/Telegram/SourceFiles/history/history.cpp @@ -1553,7 +1553,9 @@ void History::readClientSideMessages() { MsgId History::readInbox() { const auto upTo = msgIdForRead(); - setUnreadCount(0); + if (unreadCountKnown()) { + setUnreadCount(0); + } readClientSideMessages(); if (upTo) { inboxRead(upTo); @@ -3022,7 +3024,9 @@ void History::clear(ClearType type) { } else { _notifications.clear(); owner().notifyHistoryCleared(this); - setUnreadCount(0); + if (unreadCountKnown()) { + setUnreadCount(0); + } if (type == ClearType::DeleteChat) { setLastMessage(nullptr); } else if (_lastMessage && *_lastMessage) {