diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-05-24 18:28:23 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2019-05-26 00:17:13 +0300 |
commit | e6442ddef75d298599b51f4e14ec14072fafa76d (patch) | |
tree | 7daf5c13d1e0ab3c6dec5a4bcd877885b57cf8fc /config | |
parent | 28f1963943f7dcaad6de6b8af78970261e8948bb (diff) |
Move some project routes under - scope
Affected routes are:
* autocomplete_sources
* project_members
* deploy_keys
* deploy_tokens
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/project.rb | 83 |
1 files changed, 44 insertions, 39 deletions
diff --git a/config/routes/project.rb b/config/routes/project.rb index 2a5ee373f14..1e94bdc245f 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -26,6 +26,8 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do module: :projects, as: :project) do + # Begin of the /-/ scope. + # Use this scope for all new project routes. scope '-' do get 'archive/*id', constraints: { format: Gitlab::PathRegex.archive_formats_regex, id: /.+?/ }, to: 'repositories#archive', as: 'archive' @@ -82,19 +84,48 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do post :cleanup end end - end - resources :autocomplete_sources, only: [] do - collection do - get 'members' - get 'issues' - get 'merge_requests' - get 'labels' - get 'milestones' - get 'commands' - get 'snippets' + resources :autocomplete_sources, only: [] do + collection do + get 'members' + get 'issues' + get 'merge_requests' + get 'labels' + get 'milestones' + get 'commands' + get 'snippets' + end + end + + resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do + collection do + delete :leave + + # Used for import team + # from another project + get :import + post :apply_import + end + + member do + post :resend_invite + end + end + + resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create, :edit, :update] do + member do + put :enable + put :disable + end + end + + resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do + member do + put :revoke + end end end + # End of the /-/ scope. # # Templates @@ -142,19 +173,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :deploy_keys, constraints: { id: /\d+/ }, only: [:index, :new, :create, :edit, :update] do - member do - put :enable - put :disable - end - end - - resources :deploy_tokens, constraints: { id: /\d+/ }, only: [] do - member do - put :revoke - end - end - resources :releases, only: [:index] resources :forks, only: [:index, :new, :create] resource :import, only: [:new, :create, :show] @@ -396,21 +414,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do end end - resources :project_members, except: [:show, :new, :edit], constraints: { id: %r{[a-zA-Z./0-9_\-#%+]+} }, concerns: :access_requestable do - collection do - delete :leave - - # Used for import team - # from another project - get :import - post :apply_import - end - - member do - post :resend_invite - end - end - resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ } resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do @@ -505,7 +508,9 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do constraints: { project_id: Gitlab::PathRegex.project_route_regex }, module: :projects, as: :project) do - Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, :network, :graphs) + Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, + :network, :graphs, :autocomplete_sources, + :project_members, :deploy_keys, :deploy_tokens) end end end |