From 1389fafc7553c7c30aa18f81f5c7572721c4fab1 Mon Sep 17 00:00:00 2001 From: Dmitriy Zaporozhets Date: Mon, 9 Mar 2020 18:23:43 +0200 Subject: [PATCH] Remove deprecated project routes Remove unscoped project routes that were deprecated before 12.1. Signed-off-by: Dmitriy Zaporozhets --- .../unreleased/dz-remove-legacy-routes.yml | 5 +++++ config/routes/project.rb | 6 +----- spec/routing/project_routing_spec.rb | 21 ------------------- 3 files changed, 6 insertions(+), 26 deletions(-) create mode 100644 changelogs/unreleased/dz-remove-legacy-routes.yml diff --git a/changelogs/unreleased/dz-remove-legacy-routes.yml b/changelogs/unreleased/dz-remove-legacy-routes.yml new file mode 100644 index 00000000000000..9233df748532ab --- /dev/null +++ b/changelogs/unreleased/dz-remove-legacy-routes.yml @@ -0,0 +1,5 @@ +--- +title: Remove project routes that were deprecated before 12.1 +merge_request: 26808 +author: +type: removed diff --git a/config/routes/project.rb b/config/routes/project.rb index 67afbe5e7f594c..a4bfac4a5f0444 100644 --- a/config/routes/project.rb +++ b/config/routes/project.rb @@ -475,11 +475,7 @@ # Legacy routes. # Introduced in 12.0. # Should be removed with https://gitlab.com/gitlab-org/gitlab/issues/28848. - Gitlab::Routing.redirect_legacy_paths(self, :settings, :branches, :tags, - :network, :graphs, :autocomplete_sources, - :project_members, :deploy_keys, :deploy_tokens, - :labels, :milestones, :services, :boards, :releases, - :forks, :group_links, :import, :avatar, :mirror, + Gitlab::Routing.redirect_legacy_paths(self, :mirror, :cycle_analytics, :mattermost, :variables, :triggers, :environments, :protected_environments, :error_tracking, :alert_management, :serverless, :clusters, :audit_events, :wikis, :merge_requests, diff --git a/spec/routing/project_routing_spec.rb b/spec/routing/project_routing_spec.rb index fd6cccba959fb6..c8ea0e35cf1831 100644 --- a/spec/routing/project_routing_spec.rb +++ b/spec/routing/project_routing_spec.rb @@ -143,8 +143,6 @@ expect(get("/gitlab/gitlabhq/-/autocomplete_sources/#{action}")).to route_to("projects/autocomplete_sources##{action}", namespace_id: 'gitlab', project_id: 'gitlabhq') end end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/autocomplete_sources/labels", "/gitlab/gitlabhq/-/autocomplete_sources/labels" end # pages_project_wikis GET /:project_id/wikis/pages(.:format) projects/wikis#pages @@ -220,8 +218,6 @@ expect(delete('/gitlab/gitlabhq/-/branches/feature%2B45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature+45/foo/bar/baz') expect(delete('/gitlab/gitlabhq/-/branches/feature@45/foo/bar/baz')).to route_to('projects/branches#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'feature@45/foo/bar/baz') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/branches", "/gitlab/gitlabhq/-/branches" end describe Projects::TagsController, 'routing' do @@ -249,8 +245,6 @@ let(:controller) { 'deploy_keys' } let(:controller_path) { '/-/deploy_keys' } end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/deploy_keys", "/gitlab/gitlabhq/-/deploy_keys" end # project_protected_branches GET /:project_id/protected_branches(.:format) protected_branches#index @@ -487,7 +481,6 @@ let(:controller_path) { '/-/project_members' } end - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/project_members", "/gitlab/gitlabhq/-/project_members" it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/-/settings/members", "/gitlab/gitlabhq/-/project_members" end @@ -509,8 +502,6 @@ it 'to #promote' do expect(post('/gitlab/gitlabhq/-/milestones/1/promote')).to route_to('projects/milestones#promote', namespace_id: 'gitlab', project_id: 'gitlabhq', id: "1") end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/milestones", "/gitlab/gitlabhq/-/milestones" end # project_labels GET /:project_id/labels(.:format) labels#index @@ -518,8 +509,6 @@ it 'to #index' do expect(get('/gitlab/gitlabhq/-/labels')).to route_to('projects/labels#index', namespace_id: 'gitlab', project_id: 'gitlabhq') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/labels", "/gitlab/gitlabhq/-/labels" end # sort_project_issues POST /:project_id/issues/sort(.:format) issues#sort @@ -719,8 +708,6 @@ expect(get('/gitlab/gitlabhq/-/network/ends-with.json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json') expect(get('/gitlab/gitlabhq/-/network/master?format=json')).to route_to('projects/network#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/network/master", "/gitlab/gitlabhq/-/network/master" end describe Projects::GraphsController, 'routing' do @@ -729,8 +716,6 @@ expect(get('/gitlab/gitlabhq/-/graphs/ends-with.json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'ends-with.json') expect(get('/gitlab/gitlabhq/-/graphs/master?format=json')).to route_to('projects/graphs#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: 'master', format: 'json') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/graphs/master", "/gitlab/gitlabhq/-/graphs/master" end describe Projects::ForksController, 'routing' do @@ -741,8 +726,6 @@ it 'to #create' do expect(post('/gitlab/gitlabhq/-/forks')).to route_to('projects/forks#create', namespace_id: 'gitlab', project_id: 'gitlabhq') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/forks", "/gitlab/gitlabhq/-/forks" end # project_avatar DELETE /project/avatar(.:format) projects/avatars#destroy @@ -751,8 +734,6 @@ expect(delete('/gitlab/gitlabhq/-/avatar')).to route_to( 'projects/avatars#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq') end - - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/avatar", "/gitlab/gitlabhq/-/avatar" end describe Projects::PagesDomainsController, 'routing' do @@ -798,8 +779,6 @@ expect(get('/gitlab/gitlabhq/-/settings/repository')).to route_to('projects/settings/repository#show', namespace_id: 'gitlab', project_id: 'gitlabhq') end - it_behaves_like 'redirecting a legacy project path', "/gitlab/gitlabhq/settings/repository", "/gitlab/gitlabhq/-/settings/repository" - it 'to repository#create_deploy_token' do expect(post('gitlab/gitlabhq/-/settings/ci_cd/deploy_token/create')).to route_to('projects/settings/repository#create_deploy_token', namespace_id: 'gitlab', project_id: 'gitlabhq') end -- GitLab