diff options
author | Sam Rose <samrose3@gmail.com> | 2017-05-08 10:41:58 +0300 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2017-05-08 10:41:58 +0300 |
commit | 1ebd9dad8e4a3ade4fa829d1d5ac6cbc9825bf48 (patch) | |
tree | ea175b4ef388f79d8550a424ac5b46a535555664 /app/services | |
parent | 1a5e84febeb3f2d63c019981e80c777195c37dd2 (diff) |
Add confirm delete protected branch modal
Diffstat (limited to 'app/services')
-rw-r--r-- | app/services/delete_branch_service.rb | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/app/services/delete_branch_service.rb b/app/services/delete_branch_service.rb index 38a113caec7..64b3c0118fb 100644 --- a/app/services/delete_branch_service.rb +++ b/app/services/delete_branch_service.rb @@ -3,22 +3,14 @@ class DeleteBranchService < BaseService repository = project.repository branch = repository.find_branch(branch_name) - unless branch - return error('No such branch', 404) - end - - if branch_name == repository.root_ref - return error('Cannot remove HEAD branch', 405) - end - - if ProtectedBranch.protected?(project, branch_name) - return error('Protected branch cant be removed', 405) - end - unless current_user.can?(:push_code, project) return error('You dont have push access to repo', 405) end + unless branch + return error('No such branch', 404) + end + if repository.rm_branch(current_user, branch_name) success('Branch was removed') else |