-
Notifications
You must be signed in to change notification settings - Fork 13.1k
feat: Implement new Administration kebab reroute algorithm #29142
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
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #29142 +/- ##
===========================================
- Coverage 46.58% 44.38% -2.21%
===========================================
Files 697 653 -44
Lines 13055 11963 -1092
Branches 2223 2087 -136
===========================================
- Hits 6082 5310 -772
+ Misses 6655 6364 -291
+ Partials 318 289 -29
Flags with carried forward coverage won't be shown. Click here to find out more. |
…e hook Instead of having a second list just for the permissions now the useDefaultRoute hook uses the keys of the permissionRouteDicitonary to find the first possible page.
…Rocket.Chat into fix/admin-workspace-redirect
hugocostadev
left a comment
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.
Hi @rique223 , to make it more simple and avoid unhandled scenarios I suggest:
- using the
getAdminSidebarItemsmethod to set the default route for admin
… dictionary Changed the useDefaultRoute hook to implement the getSidebarItems function in order to get the first possible page instead of a hard coded permission dictionary.
Fixed a bug in which the administration routers useEffect would never reach the defaultRoute.replace() function due to the isLoading prop sometimes not working properly. Now the replace is done before reaching the router in order to avoid this situation.
Refactored the Workspace route redirect system to centralize the redirection logic inside of the administration router. Also fixed the typings of the useDefaultRoute hook.
…Rocket.Chat into fix/admin-workspace-redirect
|
…memberList * 'develop' of github.com:RocketChat/Rocket.Chat: fix: marketplace filters are changing size (#28738) chore: Update highlighted word color (#29407) i18n: Language update from LingoHub 🤖 on 2023-05-22Z (#29317) chore(ddp-sdk): ts-jest -> swc/jest (#29380) chore: `ToolboxAction` pressed state (#29397) chore: add logs to recurring omnichannel cron jobs (#29392) regression: `t` using always sprintf (#29396) fix: fix wrong %s translations (#29395) regression(push): fix error when selecting what to import (#29289) chore: Change ddpsdk.stream to return subscription (#29375) feat: Implement new Administration kebab reroute algorithm (#29142) chore: New mention styles (#29162)
Proposed changes (including videos or screenshots)
Jira task: WM-27
Implemented a new custom hook that finds the first page an user has permission to see before redirecting them in order to avoid infinite loops and other UX related problems. Currently it is being used only for the 'Workspace' option of the administration kebab menu but it was designed to be used with any page that follows the same modular permission logic, E.G.: Omnichannel and possibly Marketplace in a probable future.
Issue(s)
Steps to test or reproduce
Further comments