From cabcc0b1d492c33e66358cd26e4d216b536dc130 Mon Sep 17 00:00:00 2001 From: Oleg Date: Wed, 19 Aug 2026 08:28:06 +0000 Subject: [PATCH] Fix inline email images showing twice (once in the body, once as a chip) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 and an -wrapped chip, now only the . Co-Authored-By: Claude Sonnet 5 Claude-Session: https://claude.ai/code/session_01GteWhnWKTmnXcsd5jx6H7u --- src/app/(admin)/tickets/[id]/ticket-thread.tsx | 16 ++++++++++------ .../t/[token]/[ticketId]/portal-thread.tsx | 8 +++++--- src/lib/tickets/service.ts | 3 ++- src/lib/tickets/types.ts | 4 ++++ 4 files changed, 21 insertions(+), 10 deletions(-) diff --git a/src/app/(admin)/tickets/[id]/ticket-thread.tsx b/src/app/(admin)/tickets/[id]/ticket-thread.tsx index 4ea0513..a169535 100644 --- a/src/app/(admin)/tickets/[id]/ticket-thread.tsx +++ b/src/app/(admin)/tickets/[id]/ticket-thread.tsx @@ -333,9 +333,11 @@ function MessageBubble({ message }: { message: MessageDTO }) { ) : (

{message.body}

)} - {message.attachments.map((a) => ( - - ))} + {message.attachments + .filter((a) => !a.isInline) + .map((a) => ( + + ))}

{message.authorName} · {formatRelativeTime(message.createdAt)}

@@ -357,9 +359,11 @@ function MessageBubble({ message }: { message: MessageDTO }) { ) : (

{message.body}

)} - {message.attachments.map((a) => ( - - ))} + {message.attachments + .filter((a) => !a.isInline) + .map((a) => ( + + ))}

{message.authorName} · {formatRelativeTime(message.createdAt)}

diff --git a/src/app/(portal)/t/[token]/[ticketId]/portal-thread.tsx b/src/app/(portal)/t/[token]/[ticketId]/portal-thread.tsx index 7c0baae..35c31a6 100644 --- a/src/app/(portal)/t/[token]/[ticketId]/portal-thread.tsx +++ b/src/app/(portal)/t/[token]/[ticketId]/portal-thread.tsx @@ -159,9 +159,11 @@ function MessageBubble({ ) : (

{message.body}

)} - {message.attachments.map((a) => ( - - ))} + {message.attachments + .filter((a) => !a.isInline) + .map((a) => ( + + ))}

{message.authorName} · {formatRelativeTime(message.createdAt)}

diff --git a/src/lib/tickets/service.ts b/src/lib/tickets/service.ts index 9f4034d..4afe21e 100644 --- a/src/lib/tickets/service.ts +++ b/src/lib/tickets/service.ts @@ -109,7 +109,7 @@ async function getAttachmentsForMessages(messageIds: string[]): Promise