Commit 81698dea authored by Jan Provaznik's avatar Jan Provaznik

Merge branch 'dz-scope-project-snippet-routes' into 'master'

Copy project snippet routes under - scope

See merge request gitlab-org/gitlab!35022
parents 65a65a2e d2f9850f
---
title: Copy project snippet routes under - scope
merge_request: 35022
author:
type: other
......@@ -369,6 +369,19 @@ constraints(::Constraints::ProjectUrlConstrainer.new) do
end
end
# Serve snippet routes under /-/snippets.
# To ensure an old unscoped routing is used for the UI we need to
# add prefix 'as' to the scope routing and place it below original routing.
# Issue https://gitlab.com/gitlab-org/gitlab/-/issues/29572
scope '-', as: :scoped do
resources :snippets, concerns: :awardable, constraints: { id: /\d+/ } do # rubocop: disable Cop/PutProjectRoutesUnderScope
member do
get :raw
post :mark_as_spam
end
end
end
namespace :prometheus do
resources :alerts, constraints: { id: /\d+/ }, only: [:index, :create, :show, :update, :destroy] do # rubocop: disable Cop/PutProjectRoutesUnderScope
post :notify, on: :collection
......
......@@ -407,6 +407,10 @@ describe 'project routing' do
it 'to #destroy' do
expect(delete('/gitlab/gitlabhq/snippets/1')).to route_to('projects/snippets#destroy', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
it 'to #show from scope routing' do
expect(get('/gitlab/gitlabhq/-/snippets/1')).to route_to('projects/snippets#show', namespace_id: 'gitlab', project_id: 'gitlabhq', id: '1')
end
end
# test_project_hook POST /:project_id/hooks/:id/test(.:format) hooks#test
......
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