Use data context for Your work sidebar links
What does this MR do and why?
The "Your work" sidebar menu links (Projects, Groups, To-Do List, and other entries) are generated with Rails URL helpers.
Since merge request !249936 (merged), every URL helper that has an organization-scoped route pair (/o/:organization_path/...) is overridden to be organization aware. The override picks the organization prefix in this order:
Current.data_context— if it resolves to an organization (isolated organization), the link is always organization-scoped.- An explicit
organization_path:keyword argument — including an explicitnil, which forces the global path. - The organization named in the request's own URL.
Problem: when a user browses under /o/:organization_path in a non-isolated organization, the "Your work" sidebar links inherit the organization from the request URL (rule 3). For example, "To-Do List" points to /o/acme/dashboard/todos instead of /dashboard/todos.
The intended behavior, from the review discussion on !249936 (comment 3685678866), is that "Your work" is a user-level area. Its links should lead back to the global (unscoped) pages, unless the data context is an isolated organization. In that case, the links must stay organization-scoped.
This MR passes organization_path: nil to every URL helper call in the "Your work" sidebar menus (rule 2 above). Rule 1 still has priority, so isolated organizations keep the /o/:organization_path prefix. This covers the CE menus in lib/sidebars/your_work/menus/ and the EE menus in ee/lib/sidebars/your_work/menus/.
There are no visual changes to the sidebar, only the link targets change.
Recording
URL is http://gdk.test:300/o/my-org
On master, the URL's would be scoped to that organization. On this branch, they are no longer scoped.
How to test
In GDK, open a page under /o/<organization-path>/ for a non-isolated organization and check that the "Your work" sidebar links point to the global paths, for example /dashboard/todos. For an isolated organization, the links should keep the /o/<organization-path>/ prefix.
MR acceptance checklist
This checklist encourages us to confirm any changes have been analyzed to reduce risks in quality, performance, reliability, security, and maintainability.
- I have evaluated the MR acceptance checklist for this MR.