fix: forwarding a message twice does not render the attachment#6960
fix: forwarding a message twice does not render the attachment#6960OtavioStasiak wants to merge 9 commits intodevelopfrom
Conversation
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including You can disable this status message by setting the
WalkthroughRenders nested attachments using the Reply component when an attachment contains its own Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant Client as Client
participant MessageComp as Message
participant AttachmentsComp as Attachments
participant ReplyComp as Reply
participant MediaRenderers as Image/Audio/Video/AttachedActions/CollapsibleQuote
Client->>MessageComp: render message with attachments
MessageComp->>AttachmentsComp: pass attachments array
AttachmentsComp->>AttachmentsComp: evaluate removeQuote / isQuoteAttachment (checks collapsed, attachments)
alt attachment contains attachments
AttachmentsComp->>ReplyComp: render nested Reply for attachment
ReplyComp->>AttachmentsComp: (may render nested attachments)
else attachment is image/audio/video/action/collapsible
AttachmentsComp->>MediaRenderers: render appropriate renderer
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 inconclusive)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Fix all issues with AI agents
In `@app/containers/message/Components/Attachments/Attachments.tsx`:
- Around line 76-85: The nested-attachment branch fails to pass the
already-computed msg into the Reply component, so update the JSX that renders
<Reply key={index} attachment={file} ... /> to include the msg prop (e.g.,
msg={msg}) so Reply receives the computed message for translated text/display;
locate the rendering in Attachments.tsx where Reply is returned for
file.attachments?.length and add the msg prop alongside attachment, timeFormat,
getCustomEmoji and showAttachment.
In `@app/containers/message/Components/Attachments/Quote.tsx`:
- Around line 11-18: isQuoteAttachment currently doesn't exclude attachments
that contain nested attachments, so nested items can be rendered both as a Quote
and again in Attachments; add an early guard in isQuoteAttachment to return
false when the incoming file has a non-empty attachments array (e.g.
file.attachments && file.attachments.length > 0) so its behavior mirrors
removeQuote and prevents duplicate rendering in Quote and Attachments.
|
LGTM |
Proposed changes
When forwarding messages with file attachments files from forwarded messages remain invisible to users. Files located in nested attachment structures are not processed or displayed by the Reply component.
Issue(s)
https://rocketchat.atlassian.net/browse/SUP-986
How to test or reproduce
Screenshots
Types of changes
Checklist
Further comments
Summary by CodeRabbit
New Features
Bug Fixes
Tests