diff options
author | Robert Speicher <robert@gitlab.com> | 2016-10-04 13:50:21 +0300 |
---|---|---|
committer | Robert Speicher <robert@gitlab.com> | 2016-10-04 13:50:21 +0300 |
commit | ef24c62593dd7ca8bae7fd0150f394b741f9d246 (patch) | |
tree | 9812da0539ad9dac22ad3bf0ed820210762b513d /lib | |
parent | 02dd690a2eff4e5a6d40b7c55a5dbdd7ce149c31 (diff) | |
parent | 1592d57c18ba905d7bd1643ab6af56c902d709c1 (diff) |
Merge branch 'rc-improve-members-destroy-service' into 'master'
Improve `Members::DestroyService`
Part of #21979.
See merge request !6267
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/access_requests.rb | 5 | ||||
-rw-r--r-- | lib/api/members.rb | 2 |
2 files changed, 3 insertions, 4 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index 7b9de7c9598..d3db7740830 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -75,9 +75,8 @@ module API required_attributes! [:user_id] source = find_source(source_type, params[:id]) - access_requester = source.requesters.find_by!(user_id: params[:user_id]) - - ::Members::DestroyService.new(access_requester, current_user).execute + ::Members::DestroyService.new(source, current_user, params). + execute(:requesters) end end end diff --git a/lib/api/members.rb b/lib/api/members.rb index a18ce769e29..34df55fe192 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -134,7 +134,7 @@ module API if member.nil? { message: "Access revoked", id: params[:user_id].to_i } else - ::Members::DestroyService.new(member, current_user).execute + ::Members::DestroyService.new(source, current_user, params).execute present member.user, with: Entities::Member, member: member end |