Skip to content

Conversation

@rique223
Copy link
Contributor

@rique223 rique223 commented May 3, 2023

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

@codecov
Copy link

codecov bot commented May 3, 2023

Codecov Report

Merging #29142 (3b8252a) into develop (3a81099) will decrease coverage by 2.21%.
The diff coverage is 70.00%.

Impacted file tree graph

@@             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     
Flag Coverage Δ
e2e 44.37% <70.00%> (-2.18%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

@rique223 rique223 requested a review from dougfabris May 5, 2023 16:26
@rique223 rique223 marked this pull request as ready for review May 11, 2023 14:37
@rique223 rique223 requested review from a team as code owners May 11, 2023 14:37
@rique223 rique223 requested a review from hugocostadev May 11, 2023 17:44
Copy link
Contributor

@hugocostadev hugocostadev left a 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 getAdminSidebarItems method to set the default route for admin

rique223 added 2 commits May 15, 2023 17:32
… 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.
@rique223 rique223 requested a review from hugocostadev May 16, 2023 13:51
rique223 added 4 commits May 16, 2023 11:28
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
@changeset-bot
Copy link

changeset-bot bot commented May 23, 2023

⚠️ No Changeset found

Latest commit: 3b8252a

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

@dionisio-bot dionisio-bot bot added the stat: ready to merge PR tested and approved waiting for merge label May 26, 2023
@dionisio-bot dionisio-bot bot added stat: ready to merge PR tested and approved waiting for merge and removed stat: ready to merge PR tested and approved waiting for merge labels May 26, 2023
@kodiakhq kodiakhq bot merged commit f047a32 into develop May 26, 2023
@kodiakhq kodiakhq bot deleted the fix/admin-workspace-redirect branch May 26, 2023 18:56
gabriellsh added a commit that referenced this pull request May 31, 2023
…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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stat: ready to merge PR tested and approved waiting for merge

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants