diff options
Diffstat (limited to 'config')
-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_\-]+/ } |