Commit 20920bc1 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Move global autocomplete routes to /-/ scope

Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent ba432ca6
---
title: Move global autocomplete routes to /-/ scope
merge_request: 30173
author:
type: changed
...@@ -44,19 +44,6 @@ Rails.application.routes.draw do ...@@ -44,19 +44,6 @@ Rails.application.routes.draw do
use_doorkeeper_openid_connect 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 # Sign up
get 'users/sign_up/welcome' => 'registrations#welcome' get 'users/sign_up/welcome' => 'registrations#welcome'
patch 'users/sign_up/update_registration' => 'registrations#update_registration' patch 'users/sign_up/update_registration' => 'registrations#update_registration'
...@@ -75,6 +62,19 @@ Rails.application.routes.draw do ...@@ -75,6 +62,19 @@ Rails.application.routes.draw do
# Begin of the /-/ scope. # Begin of the /-/ scope.
# Use this scope for all new global routes. # Use this scope for all new global routes.
scope path: '-' do 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 # '/-/health' implemented by BasicHealthCheck middleware
get 'liveness' => 'health#liveness' get 'liveness' => 'health#liveness'
get 'readiness' => 'health#readiness' get 'readiness' => 'health#readiness'
...@@ -199,6 +199,19 @@ Rails.application.routes.draw do ...@@ -199,6 +199,19 @@ Rails.application.routes.draw do
# Deprecated routes. # Deprecated routes.
# Will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/210024 # Will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope as: :deprecated do 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 resources :invites, only: [:show], constraints: { id: /[A-Za-z0-9_-]+/ } do
member do member do
post :accept post :accept
......
...@@ -344,3 +344,27 @@ describe SentNotificationsController, 'routing' do ...@@ -344,3 +344,27 @@ describe SentNotificationsController, 'routing' do
.to route_to('sent_notifications#unsubscribe', id: '4bee17d4a63ed60cf5db53417e9aeb4c') .to route_to('sent_notifications#unsubscribe', id: '4bee17d4a63ed60cf5db53417e9aeb4c')
end end
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