Show non-read non-opened topics as unread.

This commit is contained in:
John Preston 2022-11-15 19:12:03 +04:00
parent bc5aa7338e
commit ce631436bf
2 changed files with 8 additions and 2 deletions

View file

@ -47,6 +47,7 @@ Forum::Forum(not_null<History*> history)
, _topicsList(&session(), {}, owner().maxPinnedChatsLimitValue(this)) {
Expects(_history->peer->isChannel());
if (_history->inChatList()) {
preloadTopics();
}
@ -154,6 +155,7 @@ void Forum::requestTopics() {
if (_topicsList.loaded()) {
_chatsListLoadedEvents.fire({});
}
reorderLastTopics();
requestSomeStale();
}).fail([=](const MTP::Error &error) {
_requestId = 0;
@ -409,7 +411,6 @@ ForumTopic *Forum::applyTopicAdded(
if (!creating(rootId)) {
raw->addToChatList(FilterId(), topicsList());
_chatsListChanges.fire({});
reorderLastTopics();
}
return raw;

View file

@ -743,10 +743,15 @@ Dialogs::UnreadState ForumTopic::chatListUnreadState() const {
}
Dialogs::BadgesState ForumTopic::chatListBadgesState() const {
return Dialogs::BadgesForUnread(
auto result = Dialogs::BadgesForUnread(
chatListUnreadState(),
Dialogs::CountInBadge::Messages,
Dialogs::IncludeInBadge::All);
if (!result.unread && _replies->inboxReadTillId() < 2) {
result.unread = channel()->amIn()
&& (_lastKnownServerMessageId > history()->inboxReadTillId());
}
return result;
}
Dialogs::UnreadState ForumTopic::unreadStateFor(