diff --git a/changelogs/unreleased/dz-scope-profile-routes.yml b/changelogs/unreleased/dz-scope-profile-routes.yml new file mode 100644 index 0000000000000000000000000000000000000000..6557ce8da95e235a7e8b7774400d0a9548202117 --- /dev/null +++ b/changelogs/unreleased/dz-scope-profile-routes.yml @@ -0,0 +1,5 @@ +--- +title: Copy profile route under - scope +merge_request: 45045 +author: +type: other diff --git a/config/routes.rb b/config/routes.rb index dda505a3793f1699ff02a0e012f885d3bc923af9..5c939e003c6d616d91cf5495543417d9ee29aa9f 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -274,6 +274,14 @@ draw :snippets end + # Serve profile routes under /-/ scope. + # To ensure an old unscoped routing is used for the UI we need to + # add prefix 'as' to the scope routing and place it below original routing. + # Issue https://gitlab.com/gitlab-org/gitlab/-/issues/210024 + scope '-', as: :scoped do + draw :profile + end + root to: "root#index" get '*unmatched_route', to: 'application#route_not_found' diff --git a/spec/routing/routing_spec.rb b/spec/routing/routing_spec.rb index 6b7a0d018f1c7ba80e762ca3565640d85fb7b1d8..f665dc31ee46bd23a6f899047c8e818153813fb7 100644 --- a/spec/routing/routing_spec.rb +++ b/spec/routing/routing_spec.rb @@ -133,6 +133,10 @@ it "to #show" do expect(get("/profile")).to route_to('profiles#show') end + + it 'to #show from scope routing' do + expect(get("/-/profile")).to route_to('profiles#show') + end end # profile_preferences GET /profile/preferences(.:format) profiles/preferences#show