Commit 05732d90 authored by Douwe Maan's avatar Douwe Maan Committed by Bob Van Landuyt

Rename delete_protected_branch ability to push_to_delete_protected_branch to...

Rename delete_protected_branch ability to push_to_delete_protected_branch to prevent confusion with destroy_protected_branch
parent 9d220da8
......@@ -208,7 +208,7 @@ class ProjectPolicy < BasePolicy
end
rule { can?(:master_access) }.policy do
enable :delete_protected_branch
enable :push_to_delete_protected_branch
enable :update_project_snippet
enable :update_environment
enable :update_deployment
......@@ -232,8 +232,8 @@ class ProjectPolicy < BasePolicy
rule { archived }.policy do
prevent :create_merge_request
prevent :push_to_delete_protected_branch
prevent :push_code
prevent :delete_protected_branch
prevent :update_merge_request
prevent :admin_merge_request
end
......
......@@ -61,7 +61,7 @@
title: s_('Branches|The default branch cannot be deleted') }
= icon("trash-o")
- elsif protected_branch?(@project, branch)
- if can?(current_user, :delete_protected_branch, @project)
- if can?(current_user, :push_to_delete_protected_branch, @project)
%button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip",
title: s_('Branches|Delete protected branch'),
data: { toggle: "modal",
......
......@@ -51,7 +51,7 @@ module Gitlab
return false unless can_access_git?
if protected?(ProtectedBranch, project, ref)
user.can?(:delete_protected_branch, project)
user.can?(:push_to_delete_protected_branch, project)
else
user.can?(:push_code, project)
end
......
......@@ -43,7 +43,7 @@ describe ProjectPolicy do
let(:base_master_permissions) do
%i[
delete_protected_branch update_project_snippet update_environment
push_to_delete_protected_branch update_project_snippet update_environment
update_deployment admin_project_snippet
admin_project_member admin_note admin_wiki admin_project
admin_commit_status admin_build admin_container_image
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment