Skip to content

Commit

Permalink
fix: Attachments not collapsing when using incoming webhook (#31318)
Browse files Browse the repository at this point in the history
Co-authored-by: Hugo Costa <20212776+hugocostadev@users.noreply.github.com>
  • Loading branch information
hb0789 and hugocostadev authored Jan 3, 2024
1 parent 4d473bb commit 87bba6d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/attachment-collapse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@rocket.chat/meteor": patch
---

Fixed Attachments not respecting collapse property when using incoming webhook
5 changes: 2 additions & 3 deletions apps/meteor/client/components/message/content/Attachments.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@ import AttachmentsItem from './attachments/AttachmentsItem';

type AttachmentsProps = {
attachments: MessageAttachmentBase[];
collapsed?: boolean;
id?: string | undefined;
};

const Attachments = ({ attachments, collapsed, id }: AttachmentsProps): ReactElement => {
const Attachments = ({ attachments, id }: AttachmentsProps): ReactElement => {
return (
<>
{attachments?.map((attachment, index) => (
<AttachmentsItem key={index} id={id} attachment={{ ...attachment, collapsed }} />
<AttachmentsItem key={index} id={id} attachment={{ ...attachment }} />
))}
</>
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ export const QuoteAttachment = ({ attachment }: QuoteAttachmentProps): ReactElem
{attachment.md ? <MessageContentBody md={attachment.md} /> : attachment.text.substring(attachment.text.indexOf('\n') + 1)}
{attachment.attachments && (
<AttachmentInner>
<Attachments attachments={attachment.attachments} collapsed={attachment.collapsed} />
<Attachments attachments={attachment.attachments} />
</AttachmentInner>
)}
</AttachmentDetails>
Expand Down

0 comments on commit 87bba6d

Please sign in to comment.