2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-03 07:56:03 +00:00

Fix muted state of monoforums.

This commit is contained in:
John Preston
2025-07-01 15:59:20 +04:00
parent eccfd75a83
commit 9b989329d4
3 changed files with 21 additions and 10 deletions

View File

@@ -96,6 +96,17 @@ Thread *SavedMessages::activeSubsectionThread() const {
return _activeSubsectionSublist; return _activeSubsectionSublist;
} }
Dialogs::UnreadState SavedMessages::unreadStateWithParentMuted() const {
auto result = _chatsList.unreadState();
if (_owningHistory->muted()) {
result.chatsMuted = result.chats;
result.marksMuted = result.marks;
result.messagesMuted = result.messages;
result.reactionsMuted = result.reactions;
}
return result;
}
SavedMessages::~SavedMessages() { SavedMessages::~SavedMessages() {
clear(); clear();
} }

View File

@@ -9,6 +9,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_main_list.h" #include "dialogs/dialogs_main_list.h"
namespace Dialogs {
struct UnreadState;
} // namespace Dialogs
namespace Main { namespace Main {
class Session; class Session;
} // namespace Main } // namespace Main
@@ -80,6 +84,8 @@ public:
void saveActiveSubsectionThread(not_null<Thread*> thread); void saveActiveSubsectionThread(not_null<Thread*> thread);
Thread *activeSubsectionThread() const; Thread *activeSubsectionThread() const;
[[nodiscard]] Dialogs::UnreadState unreadStateWithParentMuted() const;
[[nodiscard]] rpl::lifetime &lifetime(); [[nodiscard]] rpl::lifetime &lifetime();
private: private:

View File

@@ -2369,14 +2369,8 @@ Dialogs::UnreadState History::chatListUnreadState() const {
if (const auto forum = peer->forum()) { if (const auto forum = peer->forum()) {
return AdjustedForumUnreadState(forum->topicsList()->unreadState()); return AdjustedForumUnreadState(forum->topicsList()->unreadState());
} else if (const auto monoforum = peer->monoforum()) { } else if (const auto monoforum = peer->monoforum()) {
auto state = monoforum->chatsList()->unreadState(); return AdjustedForumUnreadState(
if (muted()) { monoforum->unreadStateWithParentMuted());
state.chatsMuted = state.chats;
state.marksMuted = state.marks;
state.messagesMuted = state.messages;
state.reactionsMuted = state.reactions;
}
return AdjustedForumUnreadState(state);
} }
return computeUnreadState(); return computeUnreadState();
} }
@@ -2391,9 +2385,9 @@ Dialogs::BadgesState History::chatListBadgesState() const {
} else if (const auto monoforum = peer->monoforum()) { } else if (const auto monoforum = peer->monoforum()) {
return adjustBadgesStateByFolder( return adjustBadgesStateByFolder(
Dialogs::BadgesForUnread( Dialogs::BadgesForUnread(
monoforum->chatsList()->unreadState(), monoforum->unreadStateWithParentMuted(),
Dialogs::CountInBadge::Chats, Dialogs::CountInBadge::Chats,
Dialogs::IncludeInBadge::UnmutedOrAll)); Dialogs::IncludeInBadge::All));
} }
return computeBadgesState(); return computeBadgesState();
} }