From a208524e1c1b26bc056649a6976a964a26595687 Mon Sep 17 00:00:00 2001 From: khizarshah01 Date: Fri, 16 Jan 2026 19:45:11 +0530 Subject: [PATCH 1/2] fix: correctly render nested media attachments in quotes --- .../AttachmentHandler/AttachmentMetadata.js | 28 +- .../views/AttachmentHandler/TextAttachment.js | 303 +++++++++++------- 2 files changed, 209 insertions(+), 122 deletions(-) diff --git a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js index 0c4eda27a..a3a4076f3 100644 --- a/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js +++ b/packages/react/src/views/AttachmentHandler/AttachmentMetadata.js @@ -41,13 +41,15 @@ const AttachmentMetadata = ({ } else if (attachment?.size) { sizeInBytes = attachment.size; } else { - sizeInBytes = 0; + return null; } const sizeInKB = (sizeInBytes / 1024).toFixed(2); return `${sizeInKB} kB`; }; + const fileSize = getFormattedFileSize(); + return ( - - ({getFormattedFileSize()}) - + {fileSize && ( + + ({fileSize}) + + )} @@ -170,134 +173,214 @@ const FileAttachment = ({ )} {attachment?.attachments && Array.isArray(attachment.attachments) && - attachment.attachments.map((nestedAttachment, index) => ( - + attachment.attachments.map((nestedAttachment, index) => { + if (nestedAttachment?.audio_url) { + return ( + + ); + } + if (nestedAttachment?.video_url) { + return ( + + ); + } + if (nestedAttachment?.image_url) { + return ( + + ); + } + // Check for wrapped attachments (mirroring Attachment.js logic) + if (nestedAttachment?.attachments?.[0]?.audio_url) { + return ( + + ); + } + if (nestedAttachment?.attachments?.[0]?.video_url) { + return ( + + ); + } + if (nestedAttachment?.attachments?.[0]?.image_url) { + return ( + + ); + } + + return ( - {nestedAttachment?.author_name && ( - <> - - @{nestedAttachment?.author_name} - - )} - - - - - {isExpanded && ( - {nestedAttachment?.text ? ( - nestedAttachment.text[0] === '[' ? ( - nestedAttachment.text.match(/\n(.*)/)?.[1] || '' - ) : ( - + - ) - ) : ( - - + @{nestedAttachment?.author_name} + + )} + + + {!nestedAttachment?.text && !nestedAttachment?.attachments && ( + + )} + + {isExpanded && ( + + {nestedAttachment?.text ? ( + nestedAttachment.text[0] === '[' ? ( + nestedAttachment.text.match(/\n(.*)/)?.[1] || '' + ) : ( + + ) + ) : ( - - {nestedAttachment?.title} - + - {getFileSizeWithFormat( - nestedAttachment?.size, - nestedAttachment?.format - )} + + {nestedAttachment?.title} + + + {getFileSizeWithFormat( + nestedAttachment?.size, + nestedAttachment?.format + )} + - - )} - - )} - - ))} + )} + + )} + + ); + })} ); From 4d44d0e06fcd82ed3c6652d4b5061294b1cd675c Mon Sep 17 00:00:00 2001 From: khizarshah01 Date: Fri, 16 Jan 2026 20:45:09 +0530 Subject: [PATCH 2/2] chore: fix formatting in TextAttachment --- .../src/views/AttachmentHandler/TextAttachment.js | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/packages/react/src/views/AttachmentHandler/TextAttachment.js b/packages/react/src/views/AttachmentHandler/TextAttachment.js index 90cd4293f..e8fd3fba1 100644 --- a/packages/react/src/views/AttachmentHandler/TextAttachment.js +++ b/packages/react/src/views/AttachmentHandler/TextAttachment.js @@ -63,10 +63,10 @@ const FileAttachment = ({ background: ${theme.colors.background}; `, (type ? variantStyles.pinnedContainer : '') || - css` + css` ${type === 'file' - ? `border: 2px solid ${theme.colors.border};` - : ''} + ? `border: 2px solid ${theme.colors.border};` + : ''} `, ]} > @@ -265,14 +265,14 @@ const FileAttachment = ({ (nestedAttachment?.type ? variantStyles.pinnedContainer : '') || - css` + css` ${!attachment?.type - ? `border: 2px solid ${theme.colors.border};` - : ''} + ? `border: 2px solid ${theme.colors.border};` + : ''} `, css` ${variantStyles.name !== undefined && - variantStyles.name.includes('bubble') + variantStyles.name.includes('bubble') ? `border-bottom-left-radius: 0.75rem; border-bottom-right-radius: 0.75rem` : ''} `,