Commit 28ee3163 authored by Dmitriy Zaporozhets's avatar Dmitriy Zaporozhets

Redirect deprecated issues routing to a new one

All unscoped issues routing like `group/project/issues/1` will be
redirected to `group/project/-/issues/1`
Signed-off-by: default avatarDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
parent 8cd238a5
---
title: Redirect issues routes under /-/ scope
merge_request: 28655
author:
type: changed
......@@ -408,12 +408,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
# Unscoped route. It will be replaced with redirect to /-/issues/
# Issue https://gitlab.com/gitlab-org/gitlab/issues/118849
scope as: 'deprecated' do
draw :issues
end
resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope
member do
delete :delete_attachment
......@@ -481,7 +475,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
:cycle_analytics, :mattermost, :variables, :triggers,
:environments, :protected_environments, :error_tracking, :alert_management,
:serverless, :clusters, :audit_events, :wikis, :merge_requests,
:vulnerability_feedback, :security, :dependencies)
:vulnerability_feedback, :security, :dependencies, :issues)
end
# rubocop: disable Cop/PutProjectRoutesUnderScope
......
......@@ -12,8 +12,7 @@
= render_ce 'projects/issues/discussion'
#designs-tab.tab-pane{ role: 'tabpanel', 'aria-labelledby': 'designs', data: { qa_selector: 'designs_tab_content'} }
- if @project.design_management_enabled?
- deprecated_route = current_page?(project_deprecated_issue_path(@project, @issue)) || request.path.start_with?(designs_project_deprecated_issue_path(@project, @issue))
#js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: deprecated_route ? project_deprecated_issue_path(@project, @issue) : project_issue_path(@project, @issue) } }
#js-design-management{ data: { project_path: @project.full_path, issue_iid: @issue.iid, issue_path: project_issue_path(@project, @issue) } }
- else
.mt-4
.row.empty-state
......
# frozen_string_literal: true
require 'spec_helper'
describe 'User views issue designs from deprecated issue routes', :js do
include DesignManagementTestHelpers
let_it_be(:project) { create(:project_empty_repo, :public) }
let_it_be(:issue) { create(:issue, project: project) }
let_it_be(:design) { create(:design, :with_file, issue: issue) }
before do
enable_design_management
end
context 'navigates from the issue view on the deprecated route' do
before do
visit project_deprecated_issue_path(project, issue)
click_link 'Designs'
wait_for_requests
end
it 'fetches list of designs' do
expect(page).to have_selector('.js-design-list-item', count: 1)
end
end
context 'navigates directly to the design collection view on the deprecated route' do
before do
visit designs_project_deprecated_issue_path(project, issue)
end
it 'expands the sidebar' do
expect(page).to have_selector('.layout-page.right-sidebar-expanded')
end
end
context 'navigates directly to the individual design view on the deprecated route' do
before do
visit designs_project_deprecated_issue_path(project, issue, vueroute: design.filename)
end
it 'sees the design' do
expect(page).to have_selector('.js-design-detail')
end
end
end
......@@ -73,7 +73,7 @@ RSpec.describe 'Dashboard Issues' do
find('.new-project-item-link').click
expect(page).to have_current_path("#{project_path}/issues/new")
expect(page).to have_current_path("#{project_path}/-/issues/new")
page.within('#content-body') do
expect(page).to have_selector('.issue-form')
......
......@@ -24,8 +24,8 @@ describe 'Update of user activity' do
'/dashboard/snippets',
'/dashboard/groups',
'/dashboard/todos',
'/group/project/issues',
'/group/project/issues/10',
'/group/project/-/issues',
'/group/project/-/issues/10',
'/group/project/-/merge_requests',
'/group/project/-/merge_requests/15'
]
......
......@@ -534,13 +534,17 @@ describe 'project routing' do
# DELETE /:project_id/issues/:id(.:format) issues#destroy
describe Projects::IssuesController, 'routing' do
it 'to #bulk_update' do
expect(post('/gitlab/gitlabhq/issues/bulk_update')).to route_to('projects/issues#bulk_update', namespace_id: 'gitlab', project_id: 'gitlabhq')
expect(post('/gitlab/gitlabhq/-/issues/bulk_update')).to route_to('projects/issues#bulk_update', namespace_id: 'gitlab', project_id: 'gitlabhq')
end
it_behaves_like 'RESTful project resources' do
let(:controller) { 'issues' }
let(:actions) { [:index, :create, :new, :edit, :show, :update] }
let(:controller_path) { '/-/issues' }
end
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues", "/gitlab/gitlabhq/-/issues"
it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/issues/1/edit", "/gitlab/gitlabhq/-/issues/1/edit"
end
# project_noteable_notes GET /:project_id/noteable/:target_type/:target_id/notes notes#index
......
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