Rename delete_protected_branch ability to push_to_delete_protected_branch to prevent confusion with destroy_protected_branch

This commit is contained in:
Douwe Maan 2018-04-02 18:30:49 +02:00 committed by Bob Van Landuyt
parent 9d220da841
commit 05732d90da
4 changed files with 5 additions and 5 deletions

View file

@ -208,7 +208,7 @@ class ProjectPolicy < BasePolicy
end end
rule { can?(:master_access) }.policy do rule { can?(:master_access) }.policy do
enable :delete_protected_branch enable :push_to_delete_protected_branch
enable :update_project_snippet enable :update_project_snippet
enable :update_environment enable :update_environment
enable :update_deployment enable :update_deployment
@ -232,8 +232,8 @@ class ProjectPolicy < BasePolicy
rule { archived }.policy do rule { archived }.policy do
prevent :create_merge_request prevent :create_merge_request
prevent :push_to_delete_protected_branch
prevent :push_code prevent :push_code
prevent :delete_protected_branch
prevent :update_merge_request prevent :update_merge_request
prevent :admin_merge_request prevent :admin_merge_request
end end

View file

@ -61,7 +61,7 @@
title: s_('Branches|The default branch cannot be deleted') } title: s_('Branches|The default branch cannot be deleted') }
= icon("trash-o") = icon("trash-o")
- elsif protected_branch?(@project, branch) - 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", %button{ class: "btn btn-remove remove-row js-ajax-loading-spinner has-tooltip",
title: s_('Branches|Delete protected branch'), title: s_('Branches|Delete protected branch'),
data: { toggle: "modal", data: { toggle: "modal",

View file

@ -51,7 +51,7 @@ module Gitlab
return false unless can_access_git? return false unless can_access_git?
if protected?(ProtectedBranch, project, ref) if protected?(ProtectedBranch, project, ref)
user.can?(:delete_protected_branch, project) user.can?(:push_to_delete_protected_branch, project)
else else
user.can?(:push_code, project) user.can?(:push_code, project)
end end

View file

@ -43,7 +43,7 @@ describe ProjectPolicy do
let(:base_master_permissions) do let(:base_master_permissions) do
%i[ %i[
delete_protected_branch update_project_snippet update_environment push_to_delete_protected_branch update_project_snippet update_environment
update_deployment admin_project_snippet update_deployment admin_project_snippet
admin_project_member admin_note admin_wiki admin_project admin_project_member admin_note admin_wiki admin_project
admin_commit_status admin_build admin_container_image admin_commit_status admin_build admin_container_image