-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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": true
is specified. Collapse always initializes as null (doesn't consider the value from the incoming webhook).Before: (regardless of specifying collapsed: true or collapsed: false)
![image](https://private-user-images.githubusercontent.com/98163873/292759907-f3d0ede6-9e25-4372-9800-6ce13e8fee40.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjU3NjEyOTYsIm5iZiI6MTcyNTc2MDk5NiwicGF0aCI6Ii85ODE2Mzg3My8yOTI3NTk5MDctZjNkMGVkZTYtOWUyNS00MzcyLTk4MDAtNmNlMTNlOGZlZTQwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA5MDglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwOTA4VDAyMDMxNlomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTgxYjk4YTA5YTMzNTRjNmMzMDYxYTMzMDdhMzU2MTViYmZjZDhlN2NkOGZkMmQ1MjMxZTY4ZDkxNmYyOWQ2MTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Pbub1YjIvo0ozr-HFhYm4iZ24kwAFTcq2Y1Z071c33I)
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