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
0
Merge Requests
0
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
Jérome Perrin
gitlab-ce
Commits
ee1b89ae
Commit
ee1b89ae
authored
Oct 20, 2017
by
Valery Sizov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport EE changes to group routes
parent
090aefdc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
38 additions
and
44 deletions
+38
-44
config/routes/group.rb
config/routes/group.rb
+35
-35
spec/routing/routing_spec.rb
spec/routing/routing_spec.rb
+3
-9
No files found.
config/routes/group.rb
View file @
ee1b89ae
...
@@ -4,7 +4,19 @@ resources :groups, only: [:index, :new, :create] do
...
@@ -4,7 +4,19 @@ resources :groups, only: [:index, :new, :create] do
post
:preview_markdown
post
:preview_markdown
end
end
scope
(
path:
'groups/*group_id'
,
constraints
(
GroupUrlConstrainer
.
new
)
do
scope
(
path:
'groups/*id'
,
controller: :groups
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
})
do
get
:edit
,
as: :edit_group
get
:issues
,
as: :issues_group
get
:merge_requests
,
as: :merge_requests_group
get
:projects
,
as: :projects_group
get
:activity
,
as: :activity_group
get
'/'
,
action: :show
,
as: :group_canonical
end
scope
(
path:
'groups/*group_id'
,
module: :groups
,
module: :groups
,
as: :group
,
as: :group
,
constraints:
{
group_id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
})
do
constraints:
{
group_id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
})
do
...
@@ -35,20 +47,8 @@ scope(path: 'groups/*group_id',
...
@@ -35,20 +47,8 @@ scope(path: 'groups/*group_id',
resources
:children
,
only:
[
:index
]
resources
:children
,
only:
[
:index
]
end
end
end
end
scope
(
path:
'groups/*id'
,
controller: :groups
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
})
do
get
:edit
,
as: :edit_group
get
:issues
,
as: :issues_group
get
:merge_requests
,
as: :merge_requests_group
get
:projects
,
as: :projects_group
get
:activity
,
as: :activity_group
get
'/'
,
action: :show
,
as: :group_canonical
end
constraints
(
GroupUrlConstrainer
.
new
)
do
scope
(
path:
'*id'
,
scope
(
path:
'*id'
,
as: :group
,
as: :group
,
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
},
constraints:
{
id:
Gitlab
::
PathRegex
.
full_namespace_route_regex
,
format:
/(html|json|atom)/
},
...
...
spec/routing/routing_spec.rb
View file @
ee1b89ae
...
@@ -285,17 +285,15 @@ end
...
@@ -285,17 +285,15 @@ end
describe
"Groups"
,
"routing"
do
describe
"Groups"
,
"routing"
do
let
(
:name
)
{
'complex.group-namegit'
}
let
(
:name
)
{
'complex.group-namegit'
}
let!
(
:group
)
{
create
(
:group
,
name:
name
)
}
before
do
allow_any_instance_of
(
GroupUrlConstrainer
).
to
receive
(
:matches?
).
and_return
(
true
)
end
it
"to #show"
do
it
"to #show"
do
expect
(
get
(
"/groups/
#{
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
name
)
expect
(
get
(
"/groups/
#{
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
name
)
end
end
it
"also supports nested groups"
do
it
"also supports nested groups"
do
expect
(
get
(
"/
#{
name
}
/
#{
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
"
#{
name
}
/
#{
name
}
"
)
nested_group
=
create
(
:group
,
parent:
group
)
expect
(
get
(
"/
#{
name
}
/
#{
nested_group
.
name
}
"
)).
to
route_to
(
'groups#show'
,
id:
"
#{
name
}
/
#{
nested_group
.
name
}
"
)
end
end
it
"also display group#show on the short path"
do
it
"also display group#show on the short path"
do
...
@@ -313,10 +311,6 @@ describe "Groups", "routing" do
...
@@ -313,10 +311,6 @@ describe "Groups", "routing" do
it
"to #members"
do
it
"to #members"
do
expect
(
get
(
"/groups/
#{
name
}
/group_members"
)).
to
route_to
(
'groups/group_members#index'
,
group_id:
name
)
expect
(
get
(
"/groups/
#{
name
}
/group_members"
)).
to
route_to
(
'groups/group_members#index'
,
group_id:
name
)
end
end
it
"also display group#show with slash in the path"
do
expect
(
get
(
'/group/subgroup'
)).
to
route_to
(
'groups#show'
,
id:
'group/subgroup'
)
end
end
end
describe
HealthCheckController
,
'routing'
do
describe
HealthCheckController
,
'routing'
do
...
...
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