Rocket.Chat
Rocket.Chat copied to clipboard
fix: webhook attachments without title cannot be collapsed/uncollapsed
Proposed changes (including videos or screenshots)
The attachments of messages sent using webhooks that don't contain a title cannot be collapsed currently. This happens because the collapse button is rendered only if there is a title for the attachment.
This happens only in cases where collapsed: true
is passed AND a title is not passed.
Before:
After:
While this is one solution, I think there can be a few different approaches, like if no title is provided, the attachment is forced to remain uncollapsed so it looks like this (notice there's no uncollapse button):
Please let me know the desired behaviour for this feature according to the design team.
PS. While working on this issue I found that in the apps/meteor/client/components/message/hooks/useCollapse.tsx file, a variable is spelled wrong (collpase instead of collapse). That is also fixed and included in this PR.
Issue(s)
closes #31762
Steps to test or reproduce
- Make an outgoing webhook.
- Pass the following command in the terminal.
curl -X POST -H 'Content-Type: application/json' --data '{
"channel": "general",
"text": "Oops! Unhandled problem occurred",
"emoji": ":rage:",
"alias": "Exception Bot",
"attachments": [
{
"color": "red",
"collapsed": true,
"fields": [
{
"title": "Message",
"value": "error message"
},
{
"title": "Stacktrace",
"value": "error file : error line"
}
]
}
]
}' http://localhost:3000/hooks/your-token
Replace http://localhost:3000/hooks/your-token
with the webhook URL of your integration.
Further comments
⚠️ No Changeset found
Latest commit: e594e539731dc634c0c014836da2e1292f9cc4d5
Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.
This PR includes no changesets
When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types
Click here to learn what changesets are, and how to add one.
Click here if you're a maintainer who wants to add a changeset to this PR
Codecov Report
Attention: 1 lines
in your changes are missing coverage. Please review.
Comparison is base (
46cdee0
) 54.51% compared to head (e594e53
) 52.73%.
Additional details and impacted files
@@ Coverage Diff @@
## develop #31770 +/- ##
===========================================
- Coverage 54.51% 52.73% -1.78%
===========================================
Files 2275 2111 -164
Lines 50138 47603 -2535
Branches 10226 9645 -581
===========================================
- Hits 27332 25105 -2227
+ Misses 20327 20171 -156
+ Partials 2479 2327 -152
Flag | Coverage Δ | |
---|---|---|
e2e | 49.92% <66.66%> (-3.52%) |
:arrow_down: |
unit | 76.47% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
Codecov Report
Attention: 1 lines
in your changes are missing coverage. Please review.
Comparison is base (
46cdee0
) 54.51% compared to head (e594e53
) 54.50%.
Additional details and impacted files
@@ Coverage Diff @@
## develop #31770 +/- ##
===========================================
- Coverage 54.51% 54.50% -0.01%
===========================================
Files 2275 2275
Lines 50138 50137 -1
Branches 10226 10225 -1
===========================================
- Hits 27332 27328 -4
Misses 20327 20327
- Partials 2479 2482 +3
Flag | Coverage Δ | |
---|---|---|
e2e | 53.43% <66.66%> (+<0.01%) |
:arrow_up: |
e2e-api | 39.90% <ø> (-0.04%) |
:arrow_down: |
unit | 76.47% <ø> (ø) |
Flags with carried forward coverage won't be shown. Click here to find out more.
@dougfabris can I please get a review on this? It seems to be an annoying issue for many users at the moment.