diff --git a/ts/messageModifiers/DeletesForMe.ts b/ts/messageModifiers/DeletesForMe.ts index b905b570514d..6ab2e7274b70 100644 --- a/ts/messageModifiers/DeletesForMe.ts +++ b/ts/messageModifiers/DeletesForMe.ts @@ -38,8 +38,9 @@ export type DeleteForMeAttributesType = { const deletes = new Map(); async function remove(item: DeleteForMeAttributesType): Promise { - await removeSyncTaskById(item.syncTaskId); - deletes.delete(item.envelopeId); + const { syncTaskId } = item; + await removeSyncTaskById(syncTaskId); + deletes.delete(syncTaskId); } export async function forMessage( @@ -84,7 +85,7 @@ export async function onDelete(item: DeleteForMeAttributesType): Promise { const logId = `DeletesForMe.onDelete(sentAt=${message.sentAt},timestamp=${item.timestamp},envelopeId=${item.envelopeId})`; - deletes.set(item.envelopeId, item); + deletes.set(item.syncTaskId, item); if (!conversation) { log.warn(`${logId}: Conversation not found!`); diff --git a/ts/messageModifiers/ViewSyncs.ts b/ts/messageModifiers/ViewSyncs.ts index 5a4f1db2e750..f302266c8547 100644 --- a/ts/messageModifiers/ViewSyncs.ts +++ b/ts/messageModifiers/ViewSyncs.ts @@ -40,7 +40,9 @@ export type ViewSyncAttributesType = { const viewSyncs = new Map(); async function remove(sync: ViewSyncAttributesType): Promise { - await DataWriter.removeSyncTaskById(sync.syncTaskId); + const { syncTaskId } = sync; + viewSyncs.delete(syncTaskId); + await DataWriter.removeSyncTaskById(syncTaskId); } export async function forMessage( diff --git a/ts/messageModifiers/generateCacheKey.ts b/ts/messageModifiers/generateCacheKey.ts deleted file mode 100644 index 246732e6bdb2..000000000000 --- a/ts/messageModifiers/generateCacheKey.ts +++ /dev/null @@ -1,24 +0,0 @@ -// Copyright 2016 Signal Messenger, LLC -// SPDX-License-Identifier: AGPL-3.0-only - -import type { MessageReceiptType } from './MessageReceipts'; - -// This function is necessary because the only thing we can guarantee will be unique is -// three pieces of data: sender, deviceId, and timestamp. -// Because we don't care which device interacted with our message, we collapse this down -// to: sender + timestamp. -// In some cases, modifiers are stored in the same map, so we also add the modifier type - -type ModifierType = MessageReceiptType | 'readsync' | 'viewsync'; - -export function generateCacheKey({ - sender, - timestamp, - type, -}: { - sender: string; - timestamp: number; - type: ModifierType; -}): string { - return `cacheKey-${sender}-${timestamp}-${type}`; -} diff --git a/ts/state/ducks/lightbox.ts b/ts/state/ducks/lightbox.ts index 9d4ed4d54305..eb30330b75e3 100644 --- a/ts/state/ducks/lightbox.ts +++ b/ts/state/ducks/lightbox.ts @@ -232,7 +232,7 @@ function filterValidAttachments( attributes: ReadonlyMessageAttributesType ): Array { return (attributes.attachments ?? []).filter( - item => item.thumbnail && !item.pending && !item.error + item => !item.pending && !item.error ); }