diff --git a/changelogs/unreleased/dz-redirect-unscoped-issue-routes.yml b/changelogs/unreleased/dz-redirect-unscoped-issue-routes.yml new file mode 100644 index 0000000000000000000000000000000000000000..41dc825975655d8fa6305b081758cb4ea103323b --- /dev/null +++ b/changelogs/unreleased/dz-redirect-unscoped-issue-routes.yml @@ -0,0 +1,5 @@ +--- +title: Redirect issues routes under /-/ scope +merge_request: 28655 +author: +type: changed diff --git a/config/routes/project.rb b/config/routes/project.rb index bad1c57a6d43213d14c03ee08a2dc9a5c9960c62..7b96d9b316ac22799203ddd77034c42c3f4fe40b 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -408,12 +408,6 @@ 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 @@ :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 diff --git a/ee/app/views/projects/issues/_discussion.html.haml b/ee/app/views/projects/issues/_discussion.html.haml index 7f070fb9cbe8b15d6d2b9f47f0b3d4b9051bc25f..99dbb2b4373690bf3fd4377190c5ec9470958708 100644 --- a/ee/app/views/projects/issues/_discussion.html.haml +++ b/ee/app/views/projects/issues/_discussion.html.haml @@ -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 diff --git a/ee/spec/features/projects/issues/design_management/user_views_designs_from_deprecated_route_spec.rb b/ee/spec/features/projects/issues/design_management/user_views_designs_from_deprecated_route_spec.rb deleted file mode 100644 index b6a11606001cc81c6eed32f2fc1d348b0a16ed0d..0000000000000000000000000000000000000000 --- a/ee/spec/features/projects/issues/design_management/user_views_designs_from_deprecated_route_spec.rb +++ /dev/null @@ -1,47 +0,0 @@ -# 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 diff --git a/spec/features/dashboard/issues_spec.rb b/spec/features/dashboard/issues_spec.rb index ff661014fb955c637d81913e3130923ac0095028..0b2811618b5ae2fe69a8ce969f288a9d717514a8 100644 --- a/spec/features/dashboard/issues_spec.rb +++ b/spec/features/dashboard/issues_spec.rb @@ -73,7 +73,7 @@ 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') diff --git a/spec/requests/user_activity_spec.rb b/spec/requests/user_activity_spec.rb index 3cd4911098a45cdccf8fee1d212f14f36f06ff2a..b24760d475b696fa3fb952bf97f014b719cf77f5 100644 --- a/spec/requests/user_activity_spec.rb +++ b/spec/requests/user_activity_spec.rb @@ -24,8 +24,8 @@ '/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' ] diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index fd6cccba959fb6fb94a58dede17cebf05c7df705..f8b98c5b7e1aa4153e0770117b10b424b26216cd 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -534,13 +534,17 @@ # 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