Commit 71c6369c authored by GitLab Bot's avatar GitLab Bot

Add latest changes from gitlab-org/gitlab@master

parent 693cbd0f
......@@ -47,7 +47,7 @@ module RoutableActions
canonical_path = routable.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."
end
......
---
title: Fix "project or group was moved" alerts showing up in the wrong pages
merge_request: 18985
author:
type: fixed
......@@ -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 |
|--------------------------------------|:----------------------:|:--------------------:|
| Title an description | ✓ | ✓ |
| Title and description | ✓ | ✓ |
| Issues assigned to milestone | ✓ | |
| Merge requests assigned to milestone | ✓ | |
| Participants and labels used | ✓ | |
......
......@@ -314,6 +314,24 @@ describe Groups::MilestonesController do
expect(controller).to set_flash[:notice].to(group_moved_message(redirect_route, group))
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
let(:redirect_route) { group.redirect_routes.create(path: 'http') }
......
......@@ -204,6 +204,24 @@ describe Projects::LabelsController do
expect(response).to redirect_to(project_labels_path(project))
expect(controller).to set_flash[:notice].to(project_moved_message(redirect_route, project))
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
......
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