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
f6453690
Commit
f6453690
authored
Jul 06, 2018
by
Jacopo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixes members api spec error
parent
29d84b61
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
10 additions
and
7 deletions
+10
-7
lib/api/helpers/members_helpers.rb
lib/api/helpers/members_helpers.rb
+4
-1
lib/api/members.rb
lib/api/members.rb
+1
-1
spec/requests/api/members_spec.rb
spec/requests/api/members_spec.rb
+5
-5
No files found.
lib/api/helpers/members_helpers.rb
View file @
f6453690
...
...
@@ -19,7 +19,10 @@ module API
def
find_all_members_for_project
(
project
)
shared_group_ids
=
project
.
project_group_links
.
pluck
(
:group_id
)
source_ids
=
[
project
.
id
,
project
.
group
&
.
id
].
concat
(
shared_group_ids
).
compact
project_group_ids
=
project
.
group
&
.
self_and_ancestors
&
.
pluck
(
:id
)
source_ids
=
[
project
.
id
,
project_group_ids
,
shared_group_ids
]
.
flatten
.
compact
Member
.
includes
(
:user
)
.
joins
(
user: :project_authorizations
)
.
where
(
project_authorizations:
{
project_id:
project
.
id
})
...
...
lib/api/members.rb
View file @
f6453690
...
...
@@ -39,7 +39,7 @@ module API
source
=
find_source
(
source_type
,
params
[
:id
])
members
=
find_all_members
(
source_type
,
source
)
members
=
members
.
references
(
:user
).
merge
(
User
.
search
(
params
[
:query
]))
if
params
[
:query
].
present?
members
=
members
.
includes
(
:user
).
references
(
:user
).
merge
(
User
.
search
(
params
[
:query
]))
if
params
[
:query
].
present?
members
=
paginate
(
members
)
present
members
,
with:
Entities
::
Member
...
...
spec/requests/api/members_spec.rb
View file @
f6453690
...
...
@@ -61,7 +61,7 @@ describe API::Members do
project
.
add_developer
(
create
(
:user
))
expect
do
get
api
(
members_url
,
ma
st
er
)
get
api
(
members_url
,
ma
intain
er
)
end
.
not_to
exceed_query_limit
(
control
)
end
...
...
@@ -112,8 +112,8 @@ describe API::Members do
end
let
(
:linked_group
)
do
create
(
:group
)
do
|
group
|
group
.
add_developer
(
linked_group_user
)
create
(
:group
)
do
|
linked_
group
|
linked_
group
.
add_developer
(
linked_group_user
)
end
end
...
...
@@ -129,7 +129,7 @@ describe API::Members do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
u
|
u
[
'id'
]
}).
to
match_array
[
ma
st
er
.
id
,
developer
.
id
,
nested_user
.
id
,
project_user
.
id
,
linked_group_user
.
id
]
expect
(
json_response
.
map
{
|
u
|
u
[
'id'
]
}).
to
match_array
[
ma
intain
er
.
id
,
developer
.
id
,
nested_user
.
id
,
project_user
.
id
,
linked_group_user
.
id
]
end
it
'finds all group members including inherited members'
do
...
...
@@ -138,7 +138,7 @@ describe API::Members do
expect
(
response
).
to
have_gitlab_http_status
(
200
)
expect
(
response
).
to
include_pagination_headers
expect
(
json_response
).
to
be_an
Array
expect
(
json_response
.
map
{
|
u
|
u
[
'id'
]
}).
to
match_array
[
ma
st
er
.
id
,
developer
.
id
,
nested_user
.
id
]
expect
(
json_response
.
map
{
|
u
|
u
[
'id'
]
}).
to
match_array
[
ma
intain
er
.
id
,
developer
.
id
,
nested_user
.
id
]
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