summaryrefslogtreecommitdiff
path: root/lib/api/access_requests.rb
diff options
context:
space:
mode:
authorRémy Coutable <remy@rymai.me>2017-10-11 16:47:08 +0200
committerRémy Coutable <remy@rymai.me>2018-02-27 16:02:22 +0100
commitbf41063679b25371b2e64542f2f469b38502edf6 (patch)
treebc7363df6d75c628f593b29426b59ba05b10a223 /lib/api/access_requests.rb
parent3bf448267b117e79f08ab2f4b769d24a705a5f0f (diff)
downloadgitlab-ce-bf41063679b25371b2e64542f2f469b38502edf6.tar.gz
Remove explicit audit event log in MembershipActions
Move it to Members::ApproveAccessRequestService. Also, note that there was a double audit event log for access request destruction. Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib/api/access_requests.rb')
-rw-r--r--lib/api/access_requests.rb8
1 files changed, 5 insertions, 3 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb
index 60ae5e6b9a2..23ea05e1105 100644
--- a/lib/api/access_requests.rb
+++ b/lib/api/access_requests.rb
@@ -53,7 +53,10 @@ module API
put ':id/access_requests/:user_id/approve' do
source = find_source(source_type, params[:id])
- member = ::Members::ApproveAccessRequestService.new(source, current_user, declared_params).execute
+ access_requester = source.requesters.find_by!(user_id: params[:user_id])
+ member = ::Members::ApproveAccessRequestService
+ .new(source, current_user, declared_params)
+ .execute(access_requester)
status :created
present member, with: Entities::Member
@@ -70,8 +73,7 @@ module API
member = source.requesters.find_by!(user_id: params[:user_id])
destroy_conditionally!(member) do
- ::Members::DestroyService.new(source, current_user, params)
- .execute(:requesters)
+ ::Members::DestroyService.new(source, current_user).execute(member)
end
end
end