diff options
author | Douwe Maan <douwe@gitlab.com> | 2018-02-27 18:18:54 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2018-02-27 18:18:54 +0000 |
commit | 810986433eab68e98db56fb63902a8c0547752cb (patch) | |
tree | 1cae57a3f92aa22ecd07f1cf7500751a8911353e /lib/api | |
parent | 732a301df1cb43fbc1440dd9558e708913cc4fdf (diff) | |
parent | 1c88d92b3fe174a56080575a14d6b473f17f7d8f (diff) | |
download | gitlab-ce-810986433eab68e98db56fb63902a8c0547752cb.tar.gz |
Merge branch 'rc/reduce-delta-with-ce-in-controllers-ce' into 'master'
Remove explicit audit event log in MembershipActions
See merge request gitlab-org/gitlab-ce!14824
Diffstat (limited to 'lib/api')
-rw-r--r-- | lib/api/access_requests.rb | 8 | ||||
-rw-r--r-- | lib/api/members.rb | 14 | ||||
-rw-r--r-- | lib/api/v3/members.rb | 2 |
3 files changed, 15 insertions, 9 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index 60ae5e6b9a2..ae13c248171 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(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(current_user).execute(member) end end end diff --git a/lib/api/members.rb b/lib/api/members.rb index bc1de37284a..8b12986d09e 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -81,12 +81,16 @@ module API source = find_source(source_type, params.delete(:id)) authorize_admin_source!(source_type, source) - member = source.members.find_by!(user_id: params.delete(:user_id)) + member = source.members.find_by!(user_id: params[:user_id]) + updated_member = + ::Members::UpdateService + .new(current_user, declared_params(include_missing: false)) + .execute(member) - if member.update_attributes(declared_params(include_missing: false)) - present member, with: Entities::Member + if updated_member.valid? + present updated_member, with: Entities::Member else - render_validation_error!(member) + render_validation_error!(updated_member) end end @@ -99,7 +103,7 @@ module API member = source.members.find_by!(user_id: params[:user_id]) destroy_conditionally!(member) do - ::Members::DestroyService.new(source, current_user, declared_params).execute + ::Members::DestroyService.new(current_user).execute(member) end end end diff --git a/lib/api/v3/members.rb b/lib/api/v3/members.rb index d7bde8ceb89..88dd598f1e9 100644 --- a/lib/api/v3/members.rb +++ b/lib/api/v3/members.rb @@ -124,7 +124,7 @@ module API status(200 ) { message: "Access revoked", id: params[:user_id].to_i } else - ::Members::DestroyService.new(source, current_user, declared_params).execute + ::Members::DestroyService.new(current_user).execute(member) present member, with: ::API::Entities::Member end |