diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-12 18:49:41 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2016-10-12 18:49:41 +0300 |
commit | 2c5a95cbeb3ac4a19ad177d03d2703235e1f1c3c (patch) | |
tree | c956b3c9f85af20df3d3d1c62e58a2bea5926267 /config/routes/user.rb | |
parent | 7c07c07d7a2b93ab81964b9cd28736652da1370a (diff) | |
download | gitlab-ce-2c5a95cbeb3ac4a19ad177d03d2703235e1f1c3c.tar.gz |
Rename users routing from /u/:username to /users/:username for consistency with other routes
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'config/routes/user.rb')
-rw-r--r-- | config/routes/user.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/config/routes/user.rb b/config/routes/user.rb index 54bbcb18f6a..ae15b9d02a3 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -1,8 +1,5 @@ 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, passwords: :passwords, @@ -23,7 +20,7 @@ constraints(UserUrlConstrainer.new) do end end -scope(path: 'u/:username', +scope(path: 'users/:username', as: :user, constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }, controller: :users) do @@ -35,3 +32,10 @@ scope(path: 'u/:username', get :snippets get '/', to: redirect('/%{username}') end + +# Compatibility with old routing +get '/u/:username', to: redirect('/%{username}'), constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } +get '/u/:username/groups', to: redirect('/users/%{username}/groups'), constraints: { username: /[a-zA-Z.0-9_\-]+/ } +get '/u/:username/projects', to: redirect('/users/%{username}/projects'), constraints: { username: /[a-zA-Z.0-9_\-]+/ } +get '/u/:username/snippets', to: redirect('/users/%{username}/snippets'), constraints: { username: /[a-zA-Z.0-9_\-]+/ } +get '/u/:username/contributed', to: redirect('/users/%{username}/contributed'), constraints: { username: /[a-zA-Z.0-9_\-]+/ } |