Commit 4a879333 authored by Dmytro Zaporozhets's avatar Dmytro Zaporozhets

Merge branch 'dz-redirect-unscoped-issue-routes' into 'master'

Redirect deprecated issues routing to a new one

Closes #208669

See merge request gitlab-org/gitlab!28655
parents f72f7455 28ee3163
---
title: Redirect issues routes under /-/ scope
merge_request: 28655
author:
type: changed
...@@ -408,12 +408,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -408,12 +408,6 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end end
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 resources :notes, only: [:create, :destroy, :update], concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope
member do member do
delete :delete_attachment delete :delete_attachment
...@@ -481,7 +475,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do ...@@ -481,7 +475,7 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
:cycle_analytics, :mattermost, :variables, :triggers, :cycle_analytics, :mattermost, :variables, :triggers,
:environments, :protected_environments, :error_tracking, :alert_management, :environments, :protected_environments, :error_tracking, :alert_management,
:serverless, :clusters, :audit_events, :wikis, :merge_requests, :serverless, :clusters, :audit_events, :wikis, :merge_requests,
:vulnerability_feedback, :security, :dependencies) :vulnerability_feedback, :security, :dependencies, :issues)
end end
# rubocop: disable Cop/PutProjectRoutesUnderScope # rubocop: disable Cop/PutProjectRoutesUnderScope
......
...@@ -12,8 +12,7 @@ ...@@ -12,8 +12,7 @@
= render_ce 'projects/issues/discussion' = render_ce 'projects/issues/discussion'
#designs-tab.tab-pane{ role: 'tabpanel', 'aria-labelledby': 'designs', data: { qa_selector: 'designs_tab_content'} } #designs-tab.tab-pane{ role: 'tabpanel', 'aria-labelledby': 'designs', data: { qa_selector: 'designs_tab_content'} }
- if @project.design_management_enabled? - 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: project_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) } }
- else - else
.mt-4 .mt-4
.row.empty-state .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 ...@@ -73,7 +73,7 @@ RSpec.describe 'Dashboard Issues' do
find('.new-project-item-link').click 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 page.within('#content-body') do
expect(page).to have_selector('.issue-form') expect(page).to have_selector('.issue-form')
......
...@@ -24,8 +24,8 @@ describe 'Update of user activity' do ...@@ -24,8 +24,8 @@ describe 'Update of user activity' do
'/dashboard/snippets', '/dashboard/snippets',
'/dashboard/groups', '/dashboard/groups',
'/dashboard/todos', '/dashboard/todos',
'/group/project/issues', '/group/project/-/issues',
'/group/project/issues/10', '/group/project/-/issues/10',
'/group/project/-/merge_requests', '/group/project/-/merge_requests',
'/group/project/-/merge_requests/15' '/group/project/-/merge_requests/15'
] ]
......
...@@ -534,13 +534,17 @@ describe 'project routing' do ...@@ -534,13 +534,17 @@ describe 'project routing' do
# DELETE /:project_id/issues/:id(.:format) issues#destroy # DELETE /:project_id/issues/:id(.:format) issues#destroy
describe Projects::IssuesController, 'routing' do describe Projects::IssuesController, 'routing' do
it 'to #bulk_update' 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 end
it_behaves_like 'RESTful project resources' do it_behaves_like 'RESTful project resources' do
let(:controller) { 'issues' } let(:controller) { 'issues' }
let(:actions) { [:index, :create, :new, :edit, :show, :update] } let(:actions) { [:index, :create, :new, :edit, :show, :update] }
let(:controller_path) { '/-/issues' }
end 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 end
# project_noteable_notes GET /:project_id/noteable/:target_type/:target_id/notes notes#index # 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