mirror of
https://github.com/signalapp/Signal-Desktop.git
synced 2026-04-02 16:23:20 +01:00
30 lines
687 B
TypeScript
30 lines
687 B
TypeScript
// Copyright 2018 Signal Messenger, LLC
|
|
// SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
import type { ConversationAttributesType } from '../model-types.d.ts';
|
|
|
|
export async function deleteExternalFiles(
|
|
conversation: ConversationAttributesType,
|
|
{
|
|
maybeDeleteAttachmentFile,
|
|
}: {
|
|
maybeDeleteAttachmentFile: (
|
|
path: string
|
|
) => Promise<{ wasDeleted: boolean }>;
|
|
}
|
|
): Promise<void> {
|
|
if (!conversation) {
|
|
return;
|
|
}
|
|
|
|
const { avatar, profileAvatar } = conversation;
|
|
|
|
if (avatar && avatar.path) {
|
|
await maybeDeleteAttachmentFile(avatar.path);
|
|
}
|
|
|
|
if (profileAvatar && profileAvatar.path) {
|
|
await maybeDeleteAttachmentFile(profileAvatar.path);
|
|
}
|
|
}
|