diff options
author | Stan Hu <stanhu@gmail.com> | 2017-10-25 21:15:35 +0300 |
---|---|---|
committer | Stan Hu <stanhu@gmail.com> | 2017-10-27 14:32:38 -0700 |
commit | d6cd7006aef0199fd346ead55bf094afcf696d40 (patch) | |
tree | 825a51e7d0302023093236801cc5cb6a4c35ce4a | |
parent | dfd6c3f824ada5558546b809fd32468325788b94 (diff) | |
download | gitlab-ce-d6cd7006aef0199fd346ead55bf094afcf696d40.tar.gz |
Fix broken Members link when relative URL root paths are usedsh-fix-broken-redirection-relative-url-root
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.
Fix other redirections failing to work with relative roots
-rw-r--r-- | app/views/layouts/nav/sidebar/_project.html.haml | 2 | ||||
-rw-r--r-- | changelogs/unreleased/sh-fix-broken-redirection-relative-url-root.yml | 5 | ||||
-rw-r--r-- | config/routes/ci.rb | 2 | ||||
-rw-r--r-- | config/routes/project.rb | 2 | ||||
-rw-r--r-- | config/routes/snippets.rb | 2 | ||||
-rw-r--r-- | config/routes/user.rb | 12 |
6 files changed, 15 insertions, 10 deletions
diff --git a/app/views/layouts/nav/sidebar/_project.html.haml b/app/views/layouts/nav/sidebar/_project.html.haml index f82207559a3..66146e61263 100644 --- a/app/views/layouts/nav/sidebar/_project.html.haml +++ b/app/views/layouts/nav/sidebar/_project.html.haml @@ -274,7 +274,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') } diff --git a/changelogs/unreleased/sh-fix-broken-redirection-relative-url-root.yml b/changelogs/unreleased/sh-fix-broken-redirection-relative-url-root.yml new file mode 100644 index 00000000000..96e5195d247 --- /dev/null +++ b/changelogs/unreleased/sh-fix-broken-redirection-relative-url-root.yml @@ -0,0 +1,5 @@ +--- +title: Fix broken Members link when relative URL root paths are used +merge_request: +author: +type: fixed diff --git a/config/routes/ci.rb b/config/routes/ci.rb index cbd4c2db852..60c1724bc05 100644 --- a/config/routes/ci.rb +++ b/config/routes/ci.rb @@ -1,5 +1,5 @@ namespace :ci do resource :lint, only: [:show, :create] - root to: redirect('/') + root to: redirect('') end diff --git a/config/routes/project.rb b/config/routes/project.rb index d05fe11f233..9f553085d50 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -393,7 +393,7 @@ constraints(ProjectUrlConstrainer.new) do end end 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] resource :repository, only: [:show], controller: :repository diff --git a/config/routes/snippets.rb b/config/routes/snippets.rb index 0a4ebac3ca3..81bc890d86b 100644 --- a/config/routes/snippets.rb +++ b/config/routes/snippets.rb @@ -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)/ } diff --git a/config/routes/user.rb b/config/routes/user.rb index e682dcd6663..733a3f6ce9a 100644 --- a/config/routes/user.rb +++ b/config/routes/user.rb @@ -22,17 +22,17 @@ scope(constraints: { username: Gitlab::PathRegex.root_namespace_route_regex }) d get :contributed, as: :contributed_projects get :snippets get :exists - 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 |