filterValidAttachments: Allow attachments with no thumbnail
This commit is contained in:
parent
028a3f3ef0
commit
fd408c52cf
4 changed files with 8 additions and 29 deletions
|
@ -38,8 +38,9 @@ export type DeleteForMeAttributesType = {
|
|||
const deletes = new Map<string, DeleteForMeAttributesType>();
|
||||
|
||||
async function remove(item: DeleteForMeAttributesType): Promise<void> {
|
||||
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<void> {
|
|||
|
||||
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!`);
|
||||
|
|
|
@ -40,7 +40,9 @@ export type ViewSyncAttributesType = {
|
|||
const viewSyncs = new Map<string, ViewSyncAttributesType>();
|
||||
|
||||
async function remove(sync: ViewSyncAttributesType): Promise<void> {
|
||||
await DataWriter.removeSyncTaskById(sync.syncTaskId);
|
||||
const { syncTaskId } = sync;
|
||||
viewSyncs.delete(syncTaskId);
|
||||
await DataWriter.removeSyncTaskById(syncTaskId);
|
||||
}
|
||||
|
||||
export async function forMessage(
|
||||
|
|
|
@ -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}`;
|
||||
}
|
|
@ -232,7 +232,7 @@ function filterValidAttachments(
|
|||
attributes: ReadonlyMessageAttributesType
|
||||
): Array<AttachmentType> {
|
||||
return (attributes.attachments ?? []).filter(
|
||||
item => item.thumbnail && !item.pending && !item.error
|
||||
item => !item.pending && !item.error
|
||||
);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue