2023-06-02 17:54:36 +00:00
|
|
|
// Copyright 2023 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import type { ConversationAttributesType } from '../model-types';
|
|
|
|
|
2023-12-13 23:58:56 +00:00
|
|
|
export function isBlocked(
|
|
|
|
attributes: Pick<ConversationAttributesType, 'e164' | 'groupId' | 'serviceId'>
|
|
|
|
): boolean {
|
2023-08-16 20:54:39 +00:00
|
|
|
const { e164, groupId, serviceId } = attributes;
|
|
|
|
if (serviceId) {
|
|
|
|
return window.storage.blocked.isServiceIdBlocked(serviceId);
|
2023-06-02 17:54:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
if (e164) {
|
|
|
|
return window.storage.blocked.isBlocked(e164);
|
|
|
|
}
|
|
|
|
|
|
|
|
if (groupId) {
|
|
|
|
return window.storage.blocked.isGroupBlocked(groupId);
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|