diff options
author | Jacopo <beschi.jacopo@gmail.com> | 2019-01-29 21:10:37 +0300 |
---|---|---|
committer | Jacopo <beschi.jacopo@gmail.com> | 2019-05-27 16:40:56 +0300 |
commit | a9827e0e18b532fb5cc3f227ce6c6bddaf7a960b (patch) | |
tree | 1cd3b68ccff5d664a2a31a3fed44626fa3ac23ad /spec/requests | |
parent | f9a2c4034f690e4ab9803522110c063d78da8f4d (diff) |
Removes duplicated members from api/projects/:id/members/all
When using the members/all api the same user was returned multiple times
when he was a member of the project/group and also of one of the
ancestor groups.
Now the member is returned only once giving priority to the membership
on the project and maintaining the same behaviour of the members UI.
Diffstat (limited to 'spec/requests')
-rw-r--r-- | spec/requests/api/members_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/requests/api/members_spec.rb b/spec/requests/api/members_spec.rb index 48869cab4da..55f38079b1f 100644 --- a/spec/requests/api/members_spec.rb +++ b/spec/requests/api/members_spec.rb @@ -132,6 +132,19 @@ describe API::Members do expect(json_response.map { |u| u['id'] }).to match_array [maintainer.id, developer.id, nested_user.id, project_user.id, linked_group_user.id] end + it 'returns only one member for each user without returning duplicated members' do + linked_group.add_developer(developer) + + get api("/projects/#{project.id}/members/all", developer) + + 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 eq [developer.id, maintainer.id, nested_user.id, project_user.id, linked_group_user.id] + expect(json_response.map { |u| u['access_level'] }).to eq [Gitlab::Access::DEVELOPER, Gitlab::Access::OWNER, Gitlab::Access::DEVELOPER, + Gitlab::Access::DEVELOPER, Gitlab::Access::DEVELOPER] + end + it 'finds all group members including inherited members' do get api("/groups/#{nested_group.id}/members/all", developer) |