summaryrefslogtreecommitdiff
path: root/lib/api/access_requests.rb
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2017-03-02 13:14:13 +0100
committerRobert Schilling <rschilling@student.tugraz.at>2017-08-28 16:40:25 +0200
commite80313f9ee5b3495a8713e6ddae111bc8106155b (patch)
treef1327448ef9e837aedb9fde9a50d6531e42a6112 /lib/api/access_requests.rb
parent998afa5f74558be215a924d95aa131a69831ca43 (diff)
downloadgitlab-ce-e80313f9ee5b3495a8713e6ddae111bc8106155b.tar.gz
Conditionally destroy a ressource
Diffstat (limited to 'lib/api/access_requests.rb')
-rw-r--r--lib/api/access_requests.rb11
1 files changed, 5 insertions, 6 deletions
diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb
index 0c5b8862d79..4fa9b2b2494 100644
--- a/lib/api/access_requests.rb
+++ b/lib/api/access_requests.rb
@@ -67,13 +67,12 @@ module API
end
delete ":id/access_requests/:user_id" do
source = find_source(source_type, params[:id])
- member = source.public_send(:requesters).find_by!(user_id: params[:user_id])
+ member = source.requesters.find_by!(user_id: params[:user_id])
- check_unmodified_since(member.updated_at)
-
- status 204
- ::Members::DestroyService.new(source, current_user, params)
- .execute(:requesters)
+ destroy_conditionally!(member) do
+ ::Members::DestroyService.new(source, current_user, params)
+ .execute(:requesters)
+ end
end
end
end