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

View file

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