Correct unread counter after first topic open.

This commit is contained in:
John Preston 2022-12-02 21:29:51 +04:00
parent 1a9c6749ae
commit 33c0c79593
1 changed files with 7 additions and 1 deletions

View File

@ -860,7 +860,13 @@ std::optional<int> RepliesList::computeUnreadCountLocally(
MsgId afterId) const {
Expects(afterId >= _inboxReadTillId);
const auto wasUnreadCountAfter = _unreadCount.current();
const auto currentUnreadCountAfter = _unreadCount.current();
const auto startingMarkingAsRead = (currentUnreadCountAfter == 0)
&& (_inboxReadTillId == 1)
&& (afterId > 1);
const auto wasUnreadCountAfter = startingMarkingAsRead
? _fullCount.current().value_or(0)
: currentUnreadCountAfter;
const auto readTillId = std::max(afterId, _rootId);
const auto wasReadTillId = _inboxReadTillId;
const auto backLoaded = (_skippedBefore == 0);