diff options
author | Robert Speicher <rspeicher@gmail.com> | 2016-10-17 20:37:23 +0200 |
---|---|---|
committer | Robert Speicher <rspeicher@gmail.com> | 2016-10-17 20:47:46 +0200 |
commit | 285172c33c6acd66af284d8f1e97a41079fe90de (patch) | |
tree | 576b7762fc4faba72f43ab766ddc90f7317e6a3d /config | |
parent | 11485c5acc9247e417838879a31af014972b999c (diff) | |
parent | a5f5c02598d189428c583572d42f38e478669771 (diff) | |
download | gitlab-ce-285172c33c6acd66af284d8f1e97a41079fe90de.tar.gz |
Merge branch 'dz-rename-user-routes' into 'master'
Rename users routing from /u/:username to /users/:username for
consistency with other routes
Renames /u/:username to /users/:username
To follow consistency with other routes (like groups) and
UsersController name.
Now when you can use `/:username` for accessing user page there is no
need in shortcut like `/u/`
See merge request !6851
Diffstat (limited to 'config')
-rw-r--r-- | config/routes/user.rb | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/config/routes/user.rb b/config/routes/user.rb index dfb5d2a2ba4..0a9c924863d 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 @@ -36,3 +33,12 @@ scope(path: 'u/:username', get :exists get '/', to: redirect('/%{username}') end + +# Compatibility with old routing +# TODO (dzaporozhets): remove in 10.0 +get '/u/:username', to: redirect('/%{username}'), constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ } +# TODO (dzaporozhets): remove in 9.0 +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_\-]+/ } |