mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-05-08 08:58:38 +01:00
Chat folders: for unread, check setting and active notification profile
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
@@ -72,7 +72,10 @@ function filterConversationsByUnread(
|
||||
includeMuted: UnreadStatsIncludeMuted
|
||||
): Array<ConversationType> {
|
||||
return conversations.filter(conversation => {
|
||||
return isConversationUnread(conversation, { includeMuted });
|
||||
return isConversationUnread(conversation, {
|
||||
activeProfile: undefined,
|
||||
includeMuted,
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user