diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-06 15:14:24 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-06 19:50:48 +0300 |
commit | 6b90ccb9fd57401912e1978cbad28cc693a2e0a1 (patch) | |
tree | 9e540eb6676f1d870d9e1276206f06d4fed10b48 /config | |
parent | 7c8c80880995e0bce822a6809fe514ce0f3fda36 (diff) | |
download | gitlab-ce-6b90ccb9fd57401912e1978cbad28cc693a2e0a1.tar.gz |
Change user & group landing page routing from /u/:name & /groups/:name to /:name
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/group.rb | 8 | ||||
-rw-r--r-- | config/routes/user.rb | 35 |
2 files changed, 31 insertions, 12 deletions
diff --git a/config/routes/group.rb b/config/routes/group.rb index 5b3e25d5e3d..47a8a0a53d4 100644 --- a/config/routes/group.rb +++ b/config/routes/group.rb @@ -1,3 +1,11 @@ +require 'constraints/group_url_constrainer' + +constraints(GroupUrlConstrainer.new) do + scope(path: ':id', as: :group, controller: :groups) do + get '/', action: :show + end +end + resources :groups, constraints: { id: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } do member do get :issues diff --git a/config/routes/user.rb b/config/routes/user.rb index bbb30cedd4d..c287039ba26 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,22 @@ 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, 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 '/', to: redirect('/%{username}') +end |