Redirect org-scoped Your Work dashboards to global path

What does this MR do and why?

The Your Work dashboards (projects, groups, milestones, labels, snippets, todos, and the top-level home/issues/merge_requests/activity pages) are only meaningful under an organization path when that organization is isolated.

This MR adds a before_action to Dashboard::ApplicationController so that when one of these pages is reached via an /o/:organization_path/... URL but the current data context is not an isolated organization, the request is redirected to the equivalent global path (query string preserved). Isolated organizations/users keep the organization-scoped path.

The redirect derives the global path by stripping the leading /o/:organization_path segment from the request path, so it always emits a relative, on-host URL and avoids url_for(params...) (forbidden by the Cop/SafeParams cop, and unusable here because some dashboard controllers such as GroupTree override #safe_params to drop routing keys).

How to set up and validate locally

  1. As a user whose home organization is not isolated, visit /o/<org-path>/dashboard/projects (or groups/activity/etc.) and confirm you are redirected to the global /dashboard/... path.
  2. As a user whose home organization is isolated, confirm the org-scoped path renders without redirecting.

Testing

New request spec: spec/requests/dashboard/organization_scoped_redirect_spec.rb.

Merge request reports

Loading
Loading