2024-06-17 19:24:39 +00:00
|
|
|
// Copyright 2019 Signal Messenger, LLC
|
|
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
|
|
|
|
import { createSelector } from 'reselect';
|
|
|
|
|
|
|
|
import { getUserACI } from './user';
|
|
|
|
import { getConversationSelector } from './conversations';
|
|
|
|
|
|
|
|
import type { AciString } from '../../types/ServiceId';
|
|
|
|
import type { GetConversationByIdType } from './conversations';
|
|
|
|
|
|
|
|
export const getDeleteSyncSendEnabled = createSelector(
|
|
|
|
getUserACI,
|
|
|
|
getConversationSelector,
|
|
|
|
(
|
|
|
|
aci: AciString | undefined,
|
2024-07-23 16:58:40 +00:00
|
|
|
conversationSelector: GetConversationByIdType
|
2024-06-17 19:24:39 +00:00
|
|
|
): boolean => {
|
|
|
|
if (!aci) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
const ourConversation = conversationSelector(aci);
|
|
|
|
if (!ourConversation) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
const { capabilities } = ourConversation;
|
|
|
|
if (!capabilities || !capabilities.deleteSync) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2024-07-23 16:58:40 +00:00
|
|
|
return true;
|
2024-06-17 19:24:39 +00:00
|
|
|
}
|
|
|
|
);
|