diff options
author | Rémy Coutable <remy@rymai.me> | 2018-02-16 17:10:22 +0300 |
---|---|---|
committer | Rémy Coutable <remy@rymai.me> | 2018-02-27 18:02:22 +0300 |
commit | 1c88d92b3fe174a56080575a14d6b473f17f7d8f (patch) | |
tree | 7150c48b368e82d70f6bfc228c3d836c7be7c3ac /lib | |
parent | e82f629be4b9c91e2611095cd4296e487ed137ef (diff) |
Improve Member services
Signed-off-by: Rémy Coutable <remy@rymai.me>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/access_requests.rb | 4 | ||||
-rw-r--r-- | lib/api/members.rb | 10 | ||||
-rw-r--r-- | lib/api/v3/members.rb | 2 |
3 files changed, 7 insertions, 9 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index 23ea05e1105..ae13c248171 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -55,7 +55,7 @@ module API access_requester = source.requesters.find_by!(user_id: params[:user_id]) member = ::Members::ApproveAccessRequestService - .new(source, current_user, declared_params) + .new(current_user, declared_params) .execute(access_requester) status :created @@ -73,7 +73,7 @@ module API member = source.requesters.find_by!(user_id: params[:user_id]) destroy_conditionally!(member) do - ::Members::DestroyService.new(source, current_user).execute(member) + ::Members::DestroyService.new(current_user).execute(member) end end end diff --git a/lib/api/members.rb b/lib/api/members.rb index 6367cde04bb..8b12986d09e 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -83,11 +83,9 @@ module API member = source.members.find_by!(user_id: params[:user_id]) updated_member = - ::Members::UpdateService.new( - source, - current_user, - declared_params(include_missing: false) - ).execute(member) + ::Members::UpdateService + .new(current_user, declared_params(include_missing: false)) + .execute(member) if updated_member.valid? present updated_member, with: Entities::Member @@ -105,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).execute(member) + ::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 dddc7d15d42..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).execute(member) + ::Members::DestroyService.new(current_user).execute(member) present member, with: ::API::Entities::Member end |