No Backbone in data layer; server/client interfaces are now similar

This commit is contained in:
Scott Nonnenberg 2021-12-10 14:51:54 -08:00 committed by GitHub
parent 064bbfe97a
commit 34fd945f83
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 573 additions and 1021 deletions

36
ts/util/cleanup.ts Normal file
View file

@ -0,0 +1,36 @@
// Copyright 2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
import type { MessageAttributesType } from '../model-types.d';
import { deletePackReference } from '../types/Stickers';
export async function cleanupMessage(
message: MessageAttributesType
): Promise<void> {
const { id, conversationId } = message;
window.reduxActions?.conversations.messageDeleted(id, conversationId);
const parentConversation = window.ConversationController.get(conversationId);
parentConversation?.debouncedUpdateLastMessage?.();
window.MessageController.unregister(id);
await deleteMessageData(message);
}
export async function deleteMessageData(
message: MessageAttributesType
): Promise<void> {
await window.Signal.Migrations.deleteExternalMessageFiles(message);
const { sticker } = message;
if (!sticker) {
return;
}
const { packId } = sticker;
if (packId) {
await deletePackReference(message.id, packId);
}
}