Commit 27990896 authored by Stan Hu's avatar Stan Hu

Fix broken Members link when relative URL root paths are used

Navigating to the "Members" section of a project would omit the
relative URL root path. Fix the redirection and eliminate the
need for a redirection in the first place.

Related Rails issue discussing omitting the leading slash in the
redirect paths: https://github.com/rails/rails/issues/21193

Fix other redirections failing to work with relative roots.
parent 47b48976
......@@ -290,7 +290,7 @@
Members
%ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(path: %w[members#show], html_options: { class: "fly-out-top-item" } ) do
= link_to project_settings_members_path(@project) do
= link_to project_project_members_path(@project) do
%strong.fly-out-top-item-name
#{ _('Members') }
......
namespace :ci do
resource :lint, only: [:show, :create]
root to: redirect('/')
root to: redirect('')
end
......@@ -443,7 +443,7 @@ constraints(ProjectUrlConstrainer.new) do
## EE-specific
namespace :settings do
get :members, to: redirect('/%{namespace_id}/%{project_id}/project_members')
get :members, to: redirect("%{namespace_id}/%{project_id}/project_members")
resource :ci_cd, only: [:show], controller: 'ci_cd'
resource :integrations, only: [:show]
......
......@@ -17,5 +17,5 @@ resources :snippets, concerns: :awardable do
end
end
get '/s/:username', to: redirect('/u/%{username}/snippets'),
get '/s/:username', to: redirect('u/%{username}/snippets'),
constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
......@@ -32,17 +32,17 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
get :snippets
get :exists
get :pipelines_quota
get '/', to: redirect('/%{username}'), as: nil
get '/', to: redirect('%{username}'), as: nil
end
# Compatibility with old routing
# TODO (dzaporozhets): remove in 10.0
get '/u/:username', to: redirect('/%{username}')
get '/u/:username', to: redirect('%{username}')
# TODO (dzaporozhets): remove in 9.0
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')
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')
end
constraints(UserUrlConstrainer.new) do
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment