Simplify edit handling of attachments

This commit is contained in:
trevor-signal
2025-10-24 15:58:25 -04:00
committed by GitHub
parent 4199c2cb5c
commit a7303477a1
3 changed files with 22 additions and 53 deletions

View File

@@ -137,29 +137,13 @@ export async function handleEditMessage(
editAttributes.message
);
// Copies over the attachments from the main message if they're the same
// and they have already been downloaded.
const attachmentSignatures: Map<string, AttachmentType> = new Map();
const previewSignatures: Map<string, AttachmentType> = new Map();
const quoteSignatures: Map<string, AttachmentType> = new Map();
mainMessage.attachments?.forEach(attachment => {
cacheAttachmentBySignature(attachmentSignatures, attachment);
});
mainMessage.preview?.forEach(preview => {
if (!preview.image) {
return;
}
cacheAttachmentBySignature(previewSignatures, preview.image);
});
if (mainMessage.quote) {
for (const attachment of mainMessage.quote.attachments) {
if (!attachment.thumbnail) {
continue;
}
cacheAttachmentBySignature(quoteSignatures, attachment.thumbnail);
}
}
const nextEditedMessagePreview = upgradedEditedMessageData.preview?.map(
preview => {