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 @@ ...@@ -290,7 +290,7 @@
Members Members
%ul.sidebar-sub-level-items.is-fly-out-only %ul.sidebar-sub-level-items.is-fly-out-only
= nav_link(path: %w[members#show], html_options: { class: "fly-out-top-item" } ) do = 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 %strong.fly-out-top-item-name
#{ _('Members') } #{ _('Members') }
......
namespace :ci do namespace :ci do
resource :lint, only: [:show, :create] resource :lint, only: [:show, :create]
root to: redirect('/') root to: redirect('')
end end
...@@ -443,7 +443,7 @@ constraints(ProjectUrlConstrainer.new) do ...@@ -443,7 +443,7 @@ constraints(ProjectUrlConstrainer.new) do
## EE-specific ## EE-specific
namespace :settings do 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 :ci_cd, only: [:show], controller: 'ci_cd'
resource :integrations, only: [:show] resource :integrations, only: [:show]
......
...@@ -17,5 +17,5 @@ resources :snippets, concerns: :awardable do ...@@ -17,5 +17,5 @@ resources :snippets, concerns: :awardable do
end end
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)/ } constraints: { username: /[a-zA-Z.0-9_\-]+(?<!\.atom)/ }
...@@ -32,17 +32,17 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d ...@@ -32,17 +32,17 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d
get :snippets get :snippets
get :exists get :exists
get :pipelines_quota get :pipelines_quota
get '/', to: redirect('/%{username}'), as: nil get '/', to: redirect('%{username}'), as: nil
end end
# Compatibility with old routing # Compatibility with old routing
# TODO (dzaporozhets): remove in 10.0 # TODO (dzaporozhets): remove in 10.0
get '/u/:username', to: redirect('/%{username}') get '/u/:username', to: redirect('%{username}')
# TODO (dzaporozhets): remove in 9.0 # TODO (dzaporozhets): remove in 9.0
get '/u/:username/groups', to: redirect('/users/%{username}/groups') get '/u/:username/groups', to: redirect('users/%{username}/groups')
get '/u/:username/projects', to: redirect('/users/%{username}/projects') get '/u/:username/projects', to: redirect('users/%{username}/projects')
get '/u/:username/snippets', to: redirect('/users/%{username}/snippets') get '/u/:username/snippets', to: redirect('users/%{username}/snippets')
get '/u/:username/contributed', to: redirect('/users/%{username}/contributed') get '/u/:username/contributed', to: redirect('users/%{username}/contributed')
end end
constraints(UserUrlConstrainer.new) do 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