From b6a4c0181b2a3d8bebde549cb9ad8dc6da8361d6 Mon Sep 17 00:00:00 2001 From: James Edwards-Jones Date: Sun, 25 Mar 2018 02:29:13 +0100 Subject: API uses ProtectedBranchPolicy for destroy/create --- lib/api/protected_branches.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/api') diff --git a/lib/api/protected_branches.rb b/lib/api/protected_branches.rb index c15c487deb4..b896cc93168 100644 --- a/lib/api/protected_branches.rb +++ b/lib/api/protected_branches.rb @@ -74,7 +74,10 @@ module API delete ':id/protected_branches/:name', requirements: BRANCH_ENDPOINT_REQUIREMENTS do protected_branch = user_project.protected_branches.find_by!(name: params[:name]) - destroy_conditionally!(protected_branch) + destroy_conditionally!(protected_branch) do + destroy_service = ::ProtectedBranches::DestroyService.new(user_project, current_user) + destroy_service.execute(protected_branch) + end end end end -- cgit v1.2.1