Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
d2f9850f
Commit
d2f9850f
authored
Jun 22, 2020
by
Dmitriy Zaporozhets
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Copy project snippet routes under - scope
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
cab25d36
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
0 deletions
+22
-0
changelogs/unreleased/dz-scope-project-snippet-routes.yml
changelogs/unreleased/dz-scope-project-snippet-routes.yml
+5
-0
config/routes/project.rb
config/routes/project.rb
+13
-0
spec/routing/project_routing_spec.rb
spec/routing/project_routing_spec.rb
+4
-0
No files found.
changelogs/unreleased/dz-scope-project-snippet-routes.yml
0 → 100644
View file @
d2f9850f
---
title
:
Copy project snippet routes under - scope
merge_request
:
35022
author
:
type
:
other
config/routes/project.rb
View file @
d2f9850f
...
...
@@ -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
...
...
spec/routing/project_routing_spec.rb
View file @
d2f9850f
...
...
@@ -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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment