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 not ready to merge, because of the following issues:
Please fix the issues and try again If you have any trouble, please check the PR guidelines |
|
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 (2)
📜 Recent review details🧰 Additional context used📓 Path-based instructions (1)**/*.{ts,tsx,js}📄 CodeRabbit inference engine (.cursor/rules/playwright.mdc)
Files:
🧠 Learnings (3)📚 Learning: 2026-03-06T18:10:15.268ZApplied to files:
📚 Learning: 2026-03-27T14:52:56.865ZApplied to files:
📚 Learning: 2026-05-06T12:21:44.083ZApplied to files:
🔇 Additional comments (5)
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 |
|
|
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## develop #40492 +/- ##
===========================================
+ Coverage 69.64% 69.66% +0.02%
===========================================
Files 3318 3318
Lines 121981 122048 +67
Branches 21791 21804 +13
===========================================
+ Hits 84948 85020 +72
- Misses 33701 33706 +5
+ Partials 3332 3322 -10
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