diff options
author | Stan Hu <stanhu@gmail.com> | 2019-05-22 00:06:47 +0000 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2019-05-22 00:06:47 +0000 |
commit | 4edfa5102e85b986165674a6a87f807e2362c20a (patch) | |
tree | 6c537ec6df8036e45b22cd061a5703f8b449255c /config | |
parent | e6d87e2214c3f49f0acf281f42f3b5ecd42bc85a (diff) | |
parent | eef6f768219e994fd3847694310e78040eb89815 (diff) | |
download | gitlab-ce-4edfa5102e85b986165674a6a87f807e2362c20a.tar.gz |
Merge branch 'dz-scope-project-routes' into 'master'
Move some project routes under /-/ scope
See merge request gitlab-org/gitlab-ce!28435
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/project.rb | 45 | ||||
-rw-r--r-- | config/routes/repository.rb | 2 |
2 files changed, 32 insertions, 15 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb index 93d746f3282..fdc2a3c0086 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -442,16 +442,23 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end end - namespace :settings do - get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") - resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do - post :reset_cache - put :reset_registration_token - end - resource :integrations, only: [:show] - resource :repository, only: [:show], controller: :repository do - post :create_deploy_token, path: 'deploy_token/create' - post :cleanup + + scope '-' do + namespace :settings do + get :members, to: redirect("%{namespace_id}/%{project_id}/project_members") + + resource :ci_cd, only: [:show, :update], controller: 'ci_cd' do + post :reset_cache + put :reset_registration_token + end + + resource :operations, only: [:show, :update] + resource :integrations, only: [:show] + + resource :repository, only: [:show], controller: :repository do + post :create_deploy_token, path: 'deploy_token/create' + post :cleanup + end end end @@ -465,10 +472,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do # its preferable to keep it below all other project routes draw :wiki draw :repository - - namespace :settings do - resource :operations, only: [:show, :update] - end end resources(:projects, @@ -493,4 +496,18 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end end + + # Legacy routes. + # Introduced in 12.0. + # Should be removed after 12.1 + scope(path: '*namespace_id', + as: :namespace, + namespace_id: Gitlab::PathRegex.full_namespace_route_regex) do + scope(path: ':project_id', + constraints: { project_id: Gitlab::PathRegex.project_route_regex }, + module: :projects, + as: :project) do + Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, :network, :graphs) + end + end end diff --git a/config/routes/repository.rb b/config/routes/repository.rb index f5201b9ddbb..b96315bfe8b 100644 --- a/config/routes/repository.rb +++ b/config/routes/repository.rb @@ -39,7 +39,7 @@ scope format: false do end end - scope constraints: { id: Gitlab::PathRegex.git_reference_regex } do + scope path: '-', constraints: { id: Gitlab::PathRegex.git_reference_regex } do resources :network, only: [:show] resources :graphs, only: [:show] do |