Add latest changes from gitlab-org/gitlab@master

This commit is contained in:
GitLab Bot 2019-10-26 06:06:35 +00:00
parent 693cbd0f88
commit 71c6369c63
5 changed files with 43 additions and 2 deletions

View file

@ -47,7 +47,7 @@ module RoutableActions
canonical_path = routable.full_path canonical_path = routable.full_path
if canonical_path != requested_full_path if canonical_path != requested_full_path
if canonical_path.casecmp(requested_full_path) != 0 if !request.xhr? && request.format.html? && canonical_path.casecmp(requested_full_path) != 0
flash[:notice] = "#{routable.class.to_s.titleize} '#{requested_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path." flash[:notice] = "#{routable.class.to_s.titleize} '#{requested_full_path}' was moved to '#{canonical_path}'. Please update any links and bookmarks that may still have the old path."
end end

View file

@ -0,0 +1,5 @@
---
title: Fix "project or group was moved" alerts showing up in the wrong pages
merge_request: 18985
author:
type: fixed

View file

@ -107,7 +107,7 @@ Not all features in the project milestone view are available in the group milest
| Feature | Project milestone view | Group milestone view | | Feature | Project milestone view | Group milestone view |
|--------------------------------------|:----------------------:|:--------------------:| |--------------------------------------|:----------------------:|:--------------------:|
| Title an description | ✓ | ✓ | | Title and description | ✓ | ✓ |
| Issues assigned to milestone | ✓ | | | Issues assigned to milestone | ✓ | |
| Merge requests assigned to milestone | ✓ | | | Merge requests assigned to milestone | ✓ | |
| Participants and labels used | ✓ | | | Participants and labels used | ✓ | |

View file

@ -314,6 +314,24 @@ describe Groups::MilestonesController do
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group)) expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
end end
context 'with an AJAX request' do
it 'redirects to the canonical path but does not set flash message' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }, xhr: true
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title))
expect(controller).not_to set_flash[:notice]
end
end
context 'with JSON format' do
it 'redirects to the canonical path but does not set flash message' do
get :merge_requests, params: { group_id: redirect_route.path, id: title }, format: :json
expect(response).to redirect_to(merge_requests_group_milestone_path(group.to_param, title, format: :json))
expect(controller).not_to set_flash[:notice]
end
end
context 'when the old group path is a substring of the scheme or host' do context 'when the old group path is a substring of the scheme or host' do
let(:redirect_route) { group.redirect_routes.create(path: 'http') } let(:redirect_route) { group.redirect_routes.create(path: 'http') }

View file

@ -204,6 +204,24 @@ describe Projects::LabelsController do
expect(response).to redirect_to(project_labels_path(project)) expect(response).to redirect_to(project_labels_path(project))
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project)) expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project))
end end
context 'with an AJAX request' do
it 'redirects to the canonical path but does not set flash message' do
get :index, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }, xhr: true
expect(response).to redirect_to(project_labels_path(project))
expect(controller).not_to set_flash[:notice]
end
end
context 'with JSON format' do
it 'redirects to the canonical path but does not set flash message' do
get :index, params: { namespace_id: project.namespace, project_id: project.to_param + 'old' }, format: :json
expect(response).to redirect_to(project_labels_path(project, format: :json))
expect(controller).not_to set_flash[:notice]
end
end
end end
end end
end end