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
47cf3b4b
Commit
47cf3b4b
authored
Sep 19, 2017
by
Nick Thomas
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix the groups API endpoint to handle ?owned=true correctly
parent
404a5623
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
1 deletion
+4
-1
app/finders/groups_finder.rb
app/finders/groups_finder.rb
+1
-1
spec/requests/api/groups_spec.rb
spec/requests/api/groups_spec.rb
+3
-0
No files found.
app/finders/groups_finder.rb
View file @
47cf3b4b
...
@@ -57,7 +57,7 @@ class GroupsFinder < UnionFinder
...
@@ -57,7 +57,7 @@ class GroupsFinder < UnionFinder
end
end
def
owned_groups
def
owned_groups
current_user
&
.
groups
||
Group
.
none
current_user
&
.
owned_
groups
||
Group
.
none
end
end
def
include_public_groups?
def
include_public_groups?
...
...
spec/requests/api/groups_spec.rb
View file @
47cf3b4b
...
@@ -159,11 +159,14 @@ describe API::Groups do
...
@@ -159,11 +159,14 @@ describe API::Groups do
context
'when using owned in the request'
do
context
'when using owned in the request'
do
it
'returns an array of groups the user owns'
do
it
'returns an array of groups the user owns'
do
group1
.
add_master
(
user2
)
get
api
(
'/groups'
,
user2
),
owned:
true
get
api
(
'/groups'
,
user2
),
owned:
true
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
have_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
length
).
to
eq
(
1
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
group2
.
name
)
expect
(
json_response
.
first
[
'name'
]).
to
eq
(
group2
.
name
)
end
end
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