Commit ae0b415f authored by Shinya Maeda's avatar Shinya Maeda

Merge branch 'dz-scope-autocomplete-routing' into 'master'

Move global autocomplete routes to /-/ scope

See merge request gitlab-org/gitlab!30173
parents f02405a7 20920bc1
---
title: Move global autocomplete routes to /-/ scope
merge_request: 30173
author:
type: changed
......@@ -44,19 +44,6 @@ Rails.application.routes.draw do
use_doorkeeper_openid_connect
# Autocomplete
get '/autocomplete/users' => 'autocomplete#users'
get '/autocomplete/users/:id' => 'autocomplete#user'
get '/autocomplete/projects' => 'autocomplete#projects'
get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
get '/autocomplete/merge_request_target_branches' => 'autocomplete#merge_request_target_branches'
Gitlab.ee do
get '/autocomplete/project_groups' => 'autocomplete#project_groups'
get '/autocomplete/project_routes' => 'autocomplete#project_routes'
get '/autocomplete/namespace_routes' => 'autocomplete#namespace_routes'
end
# Sign up
get 'users/sign_up/welcome' => 'registrations#welcome'
patch 'users/sign_up/update_registration' => 'registrations#update_registration'
......@@ -75,6 +62,19 @@ Rails.application.routes.draw do
# Begin of the /-/ scope.
# Use this scope for all new global routes.
scope path: '-' do
# Autocomplete
get '/autocomplete/users' => 'autocomplete#users'
get '/autocomplete/users/:id' => 'autocomplete#user'
get '/autocomplete/projects' => 'autocomplete#projects'
get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
get '/autocomplete/merge_request_target_branches' => 'autocomplete#merge_request_target_branches'
Gitlab.ee do
get '/autocomplete/project_groups' => 'autocomplete#project_groups'
get '/autocomplete/project_routes' => 'autocomplete#project_routes'
get '/autocomplete/namespace_routes' => 'autocomplete#namespace_routes'
end
# '/-/health' implemented by BasicHealthCheck middleware
get 'liveness' => 'health#liveness'
get 'readiness' => 'health#readiness'
......@@ -199,6 +199,19 @@ Rails.application.routes.draw do
# Deprecated routes.
# Will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope as: :deprecated do
# Autocomplete
get '/autocomplete/users' => 'autocomplete#users'
get '/autocomplete/users/:id' => 'autocomplete#user'
get '/autocomplete/projects' => 'autocomplete#projects'
get '/autocomplete/award_emojis' => 'autocomplete#award_emojis'
get '/autocomplete/merge_request_target_branches' => 'autocomplete#merge_request_target_branches'
Gitlab.ee do
get '/autocomplete/project_groups' => 'autocomplete#project_groups'
get '/autocomplete/project_routes' => 'autocomplete#project_routes'
get '/autocomplete/namespace_routes' => 'autocomplete#namespace_routes'
end
resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
member do
post :accept
......
......@@ -344,3 +344,27 @@ describe SentNotificationsController, 'routing' do
.to route_to('sent_notifications#unsubscribe', id: '4bee17d4a63ed60cf5db53417e9aeb4c')
end
end
describe AutocompleteController, 'routing' do
it 'to #users' do
expect(get("/-/autocomplete/users")).to route_to('autocomplete#users')
end
it 'to #projects' do
expect(get("/-/autocomplete/projects")).to route_to('autocomplete#projects')
end
it 'to #award_emojis' do
expect(get("/-/autocomplete/award_emojis")).to route_to('autocomplete#award_emojis')
end
it 'to #merge_request_target_branches' do
expect(get("/-/autocomplete/merge_request_target_branches")).to route_to('autocomplete#merge_request_target_branches')
end
it 'to legacy route' do
expect(get("/autocomplete/users")).to route_to('autocomplete#users')
expect(get("/autocomplete/projects")).to route_to('autocomplete#projects')
expect(get("/autocomplete/award_emojis")).to route_to('autocomplete#award_emojis')
end
end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment