diff options
author | Douwe Maan <douwe@gitlab.com> | 2017-11-08 11:41:56 +0300 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2017-11-08 11:41:56 +0300 |
commit | de614b0e1af598d924753497f398f0379a0c1877 (patch) | |
tree | 954657e91c8fab101065dc433b4cb2330c57e4bd /config | |
parent | cb606c5a79039706016c7537c8e72645b3668592 (diff) | |
parent | 9b0899cb809d826249bb3ad2eb35beec5bdf2190 (diff) |
Merge branch 'bvl-free-paths' into 'master'
Free some reserved group routes
See merge request gitlab-org/gitlab-ce!15052
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/group.rb | 52 |
1 files changed, 31 insertions, 21 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index f4d520a2518..db99e10bb9a 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -8,24 +8,33 @@ constraints(GroupUrlConstrainer.new) do scope(path: 'groups/*id', controller: :groups, constraints: { id: Gitlab::PathRegex.full_namespace_route_regex, format: /(html|json|atom)/ }) do - get :edit, as: :edit_group - get :issues, as: :issues_group - get :merge_requests, as: :merge_requests_group - get :projects, as: :projects_group - get :activity, as: :activity_group + scope(path: '-') do + get :edit, as: :edit_group + get :issues, as: :issues_group + get :merge_requests, as: :merge_requests_group + get :projects, as: :projects_group + get :activity, as: :activity_group + end + get '/', action: :show, as: :group_canonical end - scope(path: 'groups/*group_id', + scope(path: 'groups/*group_id/-', module: :groups, as: :group, constraints: { group_id: Gitlab::PathRegex.full_namespace_route_regex }) do - resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do - post :resend_invite, on: :member - delete :leave, on: :collection + namespace :settings do + resource :ci_cd, only: [:show], controller: 'ci_cd' + end + + resources :variables, only: [:index, :show, :update, :create, :destroy] + + resources :children, only: [:index] + + resources :labels, except: [:show] do + post :toggle_subscription, on: :member end - resource :avatar, only: [:destroy] resources :milestones, constraints: { id: /[^\/]+/ }, only: [:index, :show, :edit, :update, :new, :create] do member do get :merge_requests @@ -34,18 +43,11 @@ constraints(GroupUrlConstrainer.new) do end end - resources :labels, except: [:show] do - post :toggle_subscription, on: :member - end - - scope path: '-' do - namespace :settings do - resource :ci_cd, only: [:show], controller: 'ci_cd' - end - - resources :variables, only: [:index, :show, :update, :create, :destroy] + resource :avatar, only: [:destroy] - resources :children, only: [:index] + resources :group_members, only: [:index, :create, :update, :destroy], concerns: :access_requestable do + post :resend_invite, on: :member + delete :leave, on: :collection end end @@ -58,4 +60,12 @@ constraints(GroupUrlConstrainer.new) do put '/', action: :update delete '/', action: :destroy end + + # Legacy paths should be defined last, so they would be ignored if routes with + # one of the previously reserved words exist. + scope(path: 'groups/*group_id') do + Gitlab::Routing.redirect_legacy_paths(self, :labels, :milestones, :group_members, + :edit, :issues, :merge_requests, :projects, + :activity) + end end |