Chat folders: for unread, check setting and active notification profile

This commit is contained in:
Scott Nonnenberg
2025-11-06 07:06:52 +10:00
committed by GitHub
parent aa78798be6
commit 1925044e9d
7 changed files with 42 additions and 18 deletions
+8 -3
View File
@@ -1,12 +1,14 @@
// Copyright 2023 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { ConversationType } from '../state/ducks/conversations.preload.js';
import { isConversationInChatFolder } from '../types/ChatFolder.std.js';
import type { ChatFolderId } from '../types/ChatFolder.std.js';
import { CurrentChatFolders } from '../types/CurrentChatFolders.std.js';
import { isConversationMuted } from './isConversationMuted.std.js';
import type { ConversationType } from '../state/ducks/conversations.preload.js';
import type { ChatFolderId } from '../types/ChatFolder.std.js';
import type { NotificationProfileType } from '../types/NotificationProfile.std.js';
type MutableUnreadStats = {
/**
* Total of `conversation.unreadCount`
@@ -53,6 +55,7 @@ export type UnreadStatsIncludeMuted =
export type UnreadStatsOptions = Readonly<{
includeMuted: UnreadStatsIncludeMuted;
activeProfile: NotificationProfileType | undefined;
}>;
export type ConversationPropsForUnreadStats = Readonly<
@@ -93,7 +96,9 @@ export function _canCountConversation(
if (
_shouldExcludeMuted(options.includeMuted) &&
isConversationMuted(conversation)
(isConversationMuted(conversation) ||
(options.activeProfile &&
!options.activeProfile.allowedMembers.has(conversation.id)))
) {
return false;
}
+4 -1
View File
@@ -72,7 +72,10 @@ function filterConversationsByUnread(
includeMuted: UnreadStatsIncludeMuted
): Array<ConversationType> {
return conversations.filter(conversation => {
return isConversationUnread(conversation, { includeMuted });
return isConversationUnread(conversation, {
activeProfile: undefined,
includeMuted,
});
});
}