diff options
| author | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
|---|---|---|
| committer | Kamil Trzcinski <ayufan@ayufan.eu> | 2016-10-17 11:24:51 +0200 |
| commit | 40528a1326208a04f95f18d6dcc7547cdb8ae0c3 (patch) | |
| tree | 9e3f7ac86edfe03b218e3cd12ed9cae8b2b539f2 /config/routes | |
| parent | 0e1f39d8cee3a6d23fccb195f8257178df840805 (diff) | |
| parent | 052de0600c6b137e6f9df08250b4cf5f38280295 (diff) | |
| download | gitlab-ce-40528a1326208a04f95f18d6dcc7547cdb8ae0c3.tar.gz | |
Merge remote-tracking branch 'origin/master' into 22191-delete-dynamic-envs-mr
Diffstat (limited to 'config/routes')
| -rw-r--r-- | config/routes/group.rb | 14 | ||||
| -rw-r--r-- | config/routes/project.rb | 11 | ||||
| -rw-r--r-- | config/routes/snippets.rb | 1 | ||||
| -rw-r--r-- | config/routes/user.rb | 39 |
4 files changed, 49 insertions, 16 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index 5b3e25d5e3d..06b464d79c8 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,3 +1,17 @@ +require 'constraints/group_url_constrainer' + +constraints(GroupUrlConstrainer.new) do + scope(path: ':id', + as: :group, + constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, + controller: :groups) do + get '/', action: :show + patch '/', action: :update + put '/', action: :update + delete '/', action: :destroy + end +end + resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do member do get :issues diff --git a/config/routes/project.rb b/config/routes/project.rb index 224ec7e8324..2cd8c60794a 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -159,7 +159,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: get( '/commits/*id', to: 'commits#show', - constraints: { id: /(?:[^.]|\.(?!atom$))+/, format: /atom/ }, + constraints: { id: /.+/, format: false }, as: :commits ) end @@ -273,10 +273,12 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: post :merge post :cancel_merge_when_build_succeeds get :ci_status + get :ci_environments_status post :toggle_subscription post :remove_wip get :diff_for_path post :resolve_conflicts + post :assign_related_issues end collection do @@ -285,6 +287,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: get :update_branches get :diff_for_path post :bulk_update + get :new_diffs, path: 'new/diffs' end resources :discussions, only: [], constraints: { id: /\h{40}/ } do @@ -405,7 +408,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: end end - resources :group_links, only: [:index, :create, :destroy], constraints: { id: /\d+/ } + resources :group_links, only: [:index, :create, :update, :destroy], constraints: { id: /\d+/ } resources :notes, only: [:index, :create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do member do @@ -415,7 +418,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: end end - resource :board, only: [:show] do + resources :boards, only: [:index, :show] do scope module: :boards do resources :issues, only: [:update] @@ -424,7 +427,7 @@ resources :namespaces, path: '/', constraints: { id: /[a-zA-Z.0-9_\-]+/ }, only: post :generate end - resources :issues, only: [:index] + resources :issues, only: [:index, :create] end end end diff --git a/config/routes/snippets.rb b/config/routes/snippets.rb index 1949f215c66..3ca096f31ba 100644 --- a/config/routes/snippets.rb +++ b/config/routes/snippets.rb @@ -1,6 +1,7 @@ resources :snippets, concerns: :awardable do member do get 'raw' + get 'download' end end diff --git a/config/routes/user.rb b/config/routes/user.rb index bbb30cedd4d..dfb5d2a2ba4 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -1,15 +1,7 @@ -scope(path: 'u/:username', - as: :user, - constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, - controller: :users) do - get :calendar - get :calendar_activities - get :groups - get :projects - get :contributed, as: :contributed_projects - get :snippets - get '/', action: :show -end +require 'constraints/user_url_constrainer' + +get '/u/:username', to: redirect('/%{username}'), + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks, registrations: :registrations, @@ -21,3 +13,26 @@ devise_scope :user do get '/users/auth/:provider/omniauth_error' => 'omniauth_callbacks#omniauth_error', as: :omniauth_error get '/users/almost_there' => 'confirmations#almost_there' end + +constraints(UserUrlConstrainer.new) do + scope(path: ':username', + as: :user, + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, + controller: :users) do + get '/', action: :show + end +end + +scope(path: 'u/:username', + as: :user, + constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, + controller: :users) do + get :calendar + get :calendar_activities + get :groups + get :projects + get :contributed, as: :contributed_projects + get :snippets + get :exists + get '/', to: redirect('/%{username}') +end |
