fix: Attachments not collapsing when using incoming webhook - #31318
Conversation
🦋 Changeset detectedLatest commit: d000969 The changes in this PR will be included in the next version bump. This PR includes changesets to release 30 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #31318 +/- ##
===========================================
+ Coverage 49.34% 49.35% +0.01%
===========================================
Files 3306 3307 +1
Lines 81287 81300 +13
Branches 16650 16650
===========================================
+ Hits 40111 40128 +17
+ Misses 36481 36478 -3
+ Partials 4695 4694 -1
Flags with carried forward coverage won't be shown. Click here to find out more. |
|
hm this may be one fix .. but probably not the ideal one. IIRC when i looked at this, there was an inconsistency in how collapsed was passed at different stages vs how it was read. Just a comment for now |
|
Fair enough, I was sorta hesitant to use nullish operator but it seemed like the only option at the time. I think the inconsistency came from Long story short, the type defined in Attachments.tsx need not redeclare PS. ignore the commit history :P |
hugocostadev
left a comment
There was a problem hiding this comment.
I read your considerations and I agree with your statment...
You can remove the prop from the type declaration and also from the component that is passing the collapsed prop to
Quote component here: https://github.com/RocketChat/Rocket.Chat/blob/develop/apps/meteor/client/components/message/content/attachments/QuoteAttachment.tsx#L71
|
Perfect :) I've made the changes @hugocostadev |
|
tested |
…hideUi * 'develop' of github.com:RocketChat/Rocket.Chat: chore: add gitpod config file for quick setup (#30921) feat: Allow user to set timeout of outgoing webhook (#31222) feat: added modal confirmation before pinning message (#31348) fix: not being able to access or create rooms with join code (#31270) chore: services changes on lifecycle methods + throw if svc is not available (#31375) test: bump playwright (#31376) i18n: update translations (#29462) i18n: adds video call translations for Persian language (#30406) regression: `AppRow` bundleIn verification (#31373) feat: Add Desktop PDF viewer (#31279) fix: Attachments not collapsing when using incoming webhook (#31318) chore: add aria-label to Select Inputs at Engagement Dashboard (#31249) fix: engagement dashboard timezone selector (#31248)
Proposed changes (including videos or screenshots)
Right now there has been a long-standing issue where attachments don't collapse even when
"collapsed": trueis specified. Collapse always initializes as null (doesn't consider the value from the incoming webhook).Before: (regardless of specifying collapsed: true or collapsed: false)

After:
Untitled.video.-.Made.with.Clipchamp.9.mp4
Issue(s)
fix #29276
Steps to test or reproduce
Further comments
curl -H "X-Auth-Token: my-token" \ -H "X-User-Id: my-id" \ -H "Content-type:application/json" \ https://localhost:3000/api/v1/chat.postMessage \ -d '{"channel":"#general","emoji":":smirk:","text":"Sample message","attachments":[{"collapsed":true,"color":"#abcdef","fields":[{"title":"test 1","value":"test 1 value"},{"title":"test 2","value":"test 2 value"}],"text":"test text","title":"test title","title_link":"https://youtube.com","ts":"2016-12-09T16:53:06.761Z"}]}'This command can be used to test the modification