mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-24 06:22:59 +02:00
parent
4039d7ab71
commit
bf51e911b8
5 changed files with 27 additions and 19 deletions
|
@ -96,17 +96,6 @@ Thread *SavedMessages::activeSubsectionThread() const {
|
|||
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() {
|
||||
clear();
|
||||
}
|
||||
|
|
|
@ -84,8 +84,6 @@ public:
|
|||
void saveActiveSubsectionThread(not_null<Thread*> thread);
|
||||
Thread *activeSubsectionThread() const;
|
||||
|
||||
[[nodiscard]] Dialogs::UnreadState unreadStateWithParentMuted() const;
|
||||
|
||||
[[nodiscard]] rpl::lifetime &lifetime();
|
||||
|
||||
private:
|
||||
|
|
|
@ -120,6 +120,10 @@ void MainList::unreadStateChanged(
|
|||
const auto notify = !useClouded || wasState.known;
|
||||
const auto notifier = unreadStateChangeNotifier(notify);
|
||||
_unreadState += nowState - wasState;
|
||||
if (_unreadState.chatsMuted > _unreadState.chats
|
||||
|| _unreadState.messagesMuted > _unreadState.messages) {
|
||||
[[maybe_unused]] int a = 0;
|
||||
}
|
||||
if (updateCloudUnread) {
|
||||
Assert(nowState.known);
|
||||
_cloudUnreadState += nowState - wasState;
|
||||
|
@ -145,6 +149,10 @@ void MainList::unreadEntryChanged(
|
|||
} else {
|
||||
_unreadState -= state;
|
||||
}
|
||||
if (_unreadState.chatsMuted > _unreadState.chats
|
||||
|| _unreadState.messagesMuted > _unreadState.messages) {
|
||||
[[maybe_unused]] int a = 0;
|
||||
}
|
||||
if (updateCloudUnread) {
|
||||
if (added) {
|
||||
_cloudUnreadState += state;
|
||||
|
|
|
@ -2370,7 +2370,7 @@ Dialogs::UnreadState History::chatListUnreadState() const {
|
|||
return AdjustedForumUnreadState(forum->topicsList()->unreadState());
|
||||
} else if (const auto monoforum = peer->monoforum()) {
|
||||
return AdjustedForumUnreadState(
|
||||
monoforum->unreadStateWithParentMuted());
|
||||
withMyMuted(monoforum->chatsList()->unreadState()));;
|
||||
}
|
||||
return computeUnreadState();
|
||||
}
|
||||
|
@ -2385,7 +2385,7 @@ Dialogs::BadgesState History::chatListBadgesState() const {
|
|||
} else if (const auto monoforum = peer->monoforum()) {
|
||||
return adjustBadgesStateByFolder(
|
||||
Dialogs::BadgesForUnread(
|
||||
monoforum->unreadStateWithParentMuted(),
|
||||
withMyMuted(monoforum->chatsList()->unreadState()),
|
||||
Dialogs::CountInBadge::Chats,
|
||||
Dialogs::IncludeInBadge::All));
|
||||
}
|
||||
|
@ -2426,6 +2426,16 @@ Dialogs::UnreadState History::computeUnreadState() const {
|
|||
return result;
|
||||
}
|
||||
|
||||
Dialogs::UnreadState History::withMyMuted(Dialogs::UnreadState state) const {
|
||||
if (muted()) {
|
||||
state.chatsMuted = state.chats;
|
||||
state.marksMuted = state.marks;
|
||||
state.messagesMuted = state.messages;
|
||||
state.reactionsMuted = state.reactions;
|
||||
}
|
||||
return state;
|
||||
}
|
||||
|
||||
void History::allowChatListMessageResolve() {
|
||||
if (_flags & Flag::ResolveChatListMessage) {
|
||||
return;
|
||||
|
@ -3354,7 +3364,8 @@ bool History::isForum() const {
|
|||
void History::monoforumChanged(Data::SavedMessages *old) {
|
||||
if (inChatList()) {
|
||||
notifyUnreadStateChange(old
|
||||
? AdjustedForumUnreadState(old->chatsList()->unreadState())
|
||||
? AdjustedForumUnreadState(
|
||||
withMyMuted(old->chatsList()->unreadState()))
|
||||
: computeUnreadState());
|
||||
}
|
||||
|
||||
|
@ -3364,9 +3375,9 @@ void History::monoforumChanged(Data::SavedMessages *old) {
|
|||
monoforum->chatsList()->unreadStateChanges(
|
||||
) | rpl::filter([=] {
|
||||
return (_flags & Flag::IsMonoforumAdmin) && inChatList();
|
||||
}) | rpl::map(
|
||||
AdjustedForumUnreadState
|
||||
) | rpl::start_with_next([=](const Dialogs::UnreadState &old) {
|
||||
}) | rpl::map([=](const Dialogs::UnreadState &was) {
|
||||
return AdjustedForumUnreadState(withMyMuted(was));
|
||||
}) | rpl::start_with_next([=](const Dialogs::UnreadState &old) {
|
||||
notifyUnreadStateChange(old);
|
||||
}, monoforum->lifetime());
|
||||
|
||||
|
|
|
@ -602,6 +602,8 @@ private:
|
|||
[[nodiscard]] Dialogs::BadgesState adjustBadgesStateByFolder(
|
||||
Dialogs::BadgesState state) const;
|
||||
[[nodiscard]] Dialogs::UnreadState computeUnreadState() const;
|
||||
[[nodiscard]] Dialogs::UnreadState withMyMuted(
|
||||
Dialogs::UnreadState state) const;
|
||||
void setFolderPointer(Data::Folder *folder);
|
||||
|
||||
void hasUnreadMentionChanged(bool has) override;
|
||||
|
|
Loading…
Add table
Reference in a new issue