Generalize keepMutedChatsArchived check
This commit is contained in:
parent
f3b68677b3
commit
dff924c0c5
3 changed files with 27 additions and 7 deletions
23
ts/util/canConversationBeUnarchived.ts
Normal file
23
ts/util/canConversationBeUnarchived.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2023 Signal Messenger, LLC
|
||||
// SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
import type { ConversationAttributesType } from '../model-types.d';
|
||||
import { isConversationMuted } from './isConversationMuted';
|
||||
|
||||
export function canConversationBeUnarchived(
|
||||
attrs: ConversationAttributesType
|
||||
): boolean {
|
||||
if (!attrs.isArchived) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!isConversationMuted(attrs)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (window.storage.get('keepMutedChatsArchived') ?? false) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue