fix: hide 'Delete all closed chats' button when user lacks remove-closed-livechat-rooms permission#40492
Conversation
…sed-livechat-rooms permission
The kebab menu item 'Delete all closed chats' in the Omnichannel Contact Center
was always visible regardless of user permissions. While the backend correctly
checked the 'remove-closed-livechat-rooms' permission and returned an error,
the frontend did not gate the button visibility on this permission.
Added usePermission('remove-closed-livechat-rooms') check to conditionally
render the menu item and hide the entire kebab menu when there are no
permitted actions.
Co-authored-by: Martin Schoeler <martin.schoeler@rocket.chat>
|
Looks like this PR is ready to merge! 🎉 |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
✅ Files skipped from review due to trivial changes (1)
📜 Recent review details⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
Walkthrough
ChangesPermission-gated delete all closed chats
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested labels
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning Review ran into problems🔥 ProblemsErrors were encountered while retrieving linked issues. Errors (1)
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 |
🦋 Changeset detectedLatest commit: 6509586 The changes in this PR will be included in the next version bump. This PR includes changesets to release 42 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 Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40492 +/- ##
=========================================
Coverage 69.64% 69.64%
=========================================
Files 3318 3323 +5
Lines 121981 122677 +696
Branches 21791 21892 +101
=========================================
+ Hits 84948 85444 +496
- Misses 33701 33910 +209
+ Partials 3332 3323 -9
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
Verifies that the kebab menu with the 'Delete all closed chats' option is only rendered when the user has the 'remove-closed-livechat-rooms' permission, and hidden otherwise. Co-authored-by: Martin Schoeler <martin.schoeler@rocket.chat>
Proposed changes (including videos or screenshots)
The "Delete all closed chats" menu item in the Omnichannel Contact Center kebab menu was always visible, regardless of whether the user had the
remove-closed-livechat-roomspermission. While the backend correctly enforced the permission (returningerror-unauthorized), the frontend did not gate the button's visibility.This PR adds a
usePermission('remove-closed-livechat-rooms')check inChatsTableFilter.tsxto:This follows the same pattern already used in
ChatsTable.tsxfor the single-roomremove-closed-livechat-roompermission check.Unit tests are included to verify:
remove-closed-livechat-roomspermissionSteps to test or reproduce
remove-closed-livechat-roomspermission from all roles in Admin > PermissionsFurther comments
The change is minimal and isolated to
ChatsTableFilter.tsx. Only one file is modified for the fix, adding oneusePermissionhook call and conditionally rendering the menu items and the menu component itself. A companion test file validates the permission gating behavior.SUP-1031
Summary by CodeRabbit