Deduplicate incoming stickers from installed sticker packs

This commit is contained in:
trevor-signal
2026-02-12 12:36:53 -05:00
committed by GitHub
parent 95f131efbf
commit ae90a74cef
8 changed files with 235 additions and 194 deletions

View File

@@ -342,9 +342,8 @@ export async function queueAttachmentDownloads(
try {
log.info(`${logId}: Copying sticker from installed pack`);
copiedSticker = true;
count += 1;
const data = await copyStickerToAttachments(packId, stickerId);
const data = await copyStickerToAttachments(packId, stickerId);
// Refresh sticker attachment since we had to await above
const freshSticker = message.get('sticker');
strictAssert(freshSticker != null, 'Sticker is gone while copying');
@@ -460,13 +459,16 @@ export async function queueAttachmentDownloads(
message.set({ editHistory });
}
if (count <= 0) {
return false;
if (count > 0) {
log.info(`${logId}: Queued ${count} total attachment downloads`);
return true;
}
log.info(`${logId}: Queued ${count} total attachment downloads`);
if (copiedSticker) {
return true;
}
return true;
return false;
}
export async function queueNormalAttachments({