2016-11-03 12:29:30 +05:30
|
|
|
require 'constraints/user_url_constrainer'
|
|
|
|
|
|
|
|
devise_for :users, controllers: { omniauth_callbacks: :omniauth_callbacks,
|
|
|
|
registrations: :registrations,
|
|
|
|
passwords: :passwords,
|
|
|
|
sessions: :sessions,
|
|
|
|
confirmations: :confirmations }
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2017-09-10 17:25:29 +05:30
|
|
|
scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) do
|
2017-08-17 22:00:37 +05:30
|
|
|
scope(path: 'users/:username',
|
|
|
|
as: :user,
|
|
|
|
controller: :users) do
|
|
|
|
get :calendar
|
|
|
|
get :calendar_activities
|
|
|
|
get :groups
|
|
|
|
get :projects
|
|
|
|
get :contributed, as: :contributed_projects
|
|
|
|
get :snippets
|
|
|
|
get :exists
|
2018-03-17 18:26:18 +05:30
|
|
|
get '/', to: redirect('%{username}'), as: nil
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2016-11-03 12:29:30 +05:30
|
|
|
|
2017-08-17 22:00:37 +05:30
|
|
|
# Compatibility with old routing
|
|
|
|
# TODO (dzaporozhets): remove in 10.0
|
2018-03-17 18:26:18 +05:30
|
|
|
get '/u/:username', to: redirect('%{username}')
|
2017-08-17 22:00:37 +05:30
|
|
|
# TODO (dzaporozhets): remove in 9.0
|
2018-03-17 18:26:18 +05:30
|
|
|
get '/u/:username/groups', to: redirect('users/%{username}/groups')
|
|
|
|
get '/u/:username/projects', to: redirect('users/%{username}/projects')
|
|
|
|
get '/u/:username/snippets', to: redirect('users/%{username}/snippets')
|
|
|
|
get '/u/:username/contributed', to: redirect('users/%{username}/contributed')
|
2017-08-17 22:00:37 +05:30
|
|
|
end
|
2017-09-10 17:25:29 +05:30
|
|
|
|
|
|
|
constraints(UserUrlConstrainer.new) do
|
|
|
|
# Get all keys of user
|
|
|
|
get ':username.keys' => 'profiles/keys#get_keys', constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }
|
|
|
|
|
|
|
|
scope(path: ':username',
|
|
|
|
as: :user,
|
|
|
|
constraints: { username: Gitlab::PathRegex.root_namespace_route_regex },
|
|
|
|
controller: :users) do
|
|
|
|
get '/', action: :show
|
|
|
|
end
|
|
|
|
end
|