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
62149d37
Commit
62149d37
authored
Mar 30, 2020
by
Dmytro Zaporozhets
Committed by
charlie ablett
Mar 30, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move some global routes to - scope
Signed-off-by:
Dmitriy Zaporozhets
<
dmitriy.zaporozhets@gmail.com
>
parent
1f8beb88
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
73 additions
and
18 deletions
+73
-18
changelogs/unreleased/dz-scope-some-global-routes.yml
changelogs/unreleased/dz-scope-some-global-routes.yml
+5
-0
config/routes.rb
config/routes.rb
+37
-18
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+31
-0
No files found.
changelogs/unreleased/dz-scope-some-global-routes.yml
0 → 100644
View file @
62149d37
---
title
:
Move some global routes to - scope
merge_request
:
27106
author
:
type
:
changed
config/routes.rb
View file @
62149d37
...
...
@@ -71,6 +71,8 @@ Rails.application.routes.draw do
# Health check
get
'health_check(/:checks)'
=>
'health_check#index'
,
as: :health_check
# Begin of the /-/ scope.
# Use this scope for all new global routes.
scope
path:
'-'
do
# '/-/health' implemented by BasicHealthCheck middleware
get
'liveness'
=>
'health#liveness'
...
...
@@ -122,6 +124,10 @@ Rails.application.routes.draw do
draw
:country_state
draw
:subscription
draw
:analytics
scope
'/push_from_secondary/:geo_node_id'
do
draw
:git_http
end
end
if
ENV
[
'GITLAB_CHAOS_SECRET'
]
||
Rails
.
env
.
development?
||
Rails
.
env
.
test?
...
...
@@ -136,8 +142,25 @@ Rails.application.routes.draw do
# Notification settings
resources
:notification_settings
,
only:
[
:create
,
:update
]
resources
:invites
,
only:
[
:show
],
constraints:
{
id:
/[A-Za-z0-9_-]+/
}
do
member
do
post
:accept
match
:decline
,
via:
[
:get
,
:post
]
end
end
resources
:sent_notifications
,
only:
[],
constraints:
{
id:
/\h{32}/
}
do
member
do
get
:unsubscribe
end
end
# Spam reports
resources
:abuse_reports
,
only:
[
:new
,
:create
]
end
# End of the /-/ scope.
concern
:clusterable
do
resources
:clusters
,
only:
[
:index
,
:new
,
:show
,
:update
,
:destroy
]
do
collection
do
...
...
@@ -167,7 +190,9 @@ Rails.application.routes.draw do
end
end
# Invites
# Deprecated routes.
# Will be removed as part of https://gitlab.com/gitlab-org/gitlab/-/issues/210024
scope
as: :deprecated
do
resources
:invites
,
only:
[
:show
],
constraints:
{
id:
/[A-Za-z0-9_-]+/
}
do
member
do
post
:accept
...
...
@@ -181,8 +206,8 @@ Rails.application.routes.draw do
end
end
# Spam reports
resources
:abuse_reports
,
only:
[
:new
,
:create
]
end
resources
:groups
,
only:
[
:index
,
:new
,
:create
]
do
post
:preview_markdown
...
...
@@ -192,12 +217,6 @@ Rails.application.routes.draw do
get
'/projects/:id'
=>
'projects#resolve'
Gitlab
.
ee
do
scope
'/-/push_from_secondary/:geo_node_id'
do
draw
:git_http
end
end
draw
:git_http
draw
:api
draw
:sidekiq
...
...
spec/routing/routing_spec.rb
View file @
62149d37
...
...
@@ -313,3 +313,34 @@ describe HealthCheckController, 'routing' do
expect
(
get
(
'/health_check/email'
)).
to
route_to
(
'health_check#index'
,
checks:
'email'
)
end
end
describe
InvitesController
,
'routing'
do
let_it_be
(
:member
)
{
create
(
:project_member
,
:invited
)
}
it
'to #show'
do
expect
(
get
(
"/-/invites/
#{
member
.
invite_token
}
"
)).
to
route_to
(
'invites#show'
,
id:
member
.
invite_token
)
end
it
'to legacy route'
do
expect
(
get
(
"/invites/
#{
member
.
invite_token
}
"
)).
to
route_to
(
'invites#show'
,
id:
member
.
invite_token
)
end
end
describe
AbuseReportsController
,
'routing'
do
let_it_be
(
:user
)
{
create
(
:user
)
}
it
'to #new'
do
expect
(
get
(
"/-/abuse_reports/new?user_id=
#{
user
.
id
}
"
)).
to
route_to
(
'abuse_reports#new'
,
user_id:
user
.
id
.
to_s
)
end
it
'to legacy route'
do
expect
(
get
(
"/abuse_reports/new?user_id=
#{
user
.
id
}
"
)).
to
route_to
(
'abuse_reports#new'
,
user_id:
user
.
id
.
to_s
)
end
end
describe
SentNotificationsController
,
'routing'
do
it
'to #unsubscribe'
do
expect
(
get
(
"/-/sent_notifications/4bee17d4a63ed60cf5db53417e9aeb4c/unsubscribe"
))
.
to
route_to
(
'sent_notifications#unsubscribe'
,
id:
'4bee17d4a63ed60cf5db53417e9aeb4c'
)
end
end
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