Fix inline email images showing twice (once in the body, once as a chip)

An inline image referenced via cid: is already rendered inside message.bodyHtml
(added in the previous commit) but was also still stored as a regular
attachment row, so it showed up a second time as an AttachmentChip thumbnail
underneath the message — the images at top were correct, the small chips
below were a duplicate of the same image.

AttachmentDTO now carries isInline (true when the attachment's contentId is
set), and the message thread — both the admin ticket view and the customer
portal — filters those out of the separate attachment-chip list. Verified
against a live inbound message with a cid-referenced image: previously
rendered as both an <img> and an <a>-wrapped chip, now only the <img>.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01GteWhnWKTmnXcsd5jx6H7u
This commit is contained in:
ogrechkoandClaude Sonnet 5 committed 2026-08-19 08:28:06 +00:00
1 parent b11ec711c5
commit cabcc0b1d4
4 files changed
+21 -10

No files matched your search

+2 -1
View File
@@ -109,7 +109,7 @@ async function getAttachmentsForMessages(messageIds: string[]): Promise<Map<stri
});
for (const row of rows) {
const list = map.get(row.messageId) ?? [];
list.push({ id: row.id, filename: row.filename, mimeType: row.mimeType, sizeBytes: row.sizeBytes });
list.push({ id: row.id, filename: row.filename, mimeType: row.mimeType, sizeBytes: row.sizeBytes, isInline: Boolean(row.contentId) });
map.set(row.messageId, list);
}
return map;
@@ -155,6 +155,7 @@ async function appendMessage(params: {
filename: a.filename,
mimeType: a.mimeType,
sizeBytes: a.sizeBytes,
isInline: Boolean(a.contentId),
}));
}