diff options
Diffstat (limited to 'app/helpers')
-rw-r--r-- | app/helpers/branches_helper.rb | 9 | ||||
-rw-r--r-- | app/helpers/tree_helper.rb | 6 |
2 files changed, 3 insertions, 12 deletions
diff --git a/app/helpers/branches_helper.rb b/app/helpers/branches_helper.rb index 2ec2cc96157..4a5edf6d101 100644 --- a/app/helpers/branches_helper.rb +++ b/app/helpers/branches_helper.rb @@ -11,12 +11,7 @@ module BranchesHelper def can_push_branch?(project, branch_name) return false unless project.repository.branch_names.include?(branch_name) - action = if project.protected_branch?(branch_name) - :push_code_to_protected_branches - else - :push_code - end - - current_user.can?(action, project) + + ::Gitlab::GitAccess.can_push_to_branch?(current_user, project, branch_name) end end diff --git a/app/helpers/tree_helper.rb b/app/helpers/tree_helper.rb index d316213b1fd..133b0dfae9b 100644 --- a/app/helpers/tree_helper.rb +++ b/app/helpers/tree_helper.rb @@ -58,11 +58,7 @@ module TreeHelper ref ||= @ref return false unless project.repository.branch_names.include?(ref) - if project.protected_branch? ref - can?(current_user, :push_code_to_protected_branches, project) - else - can?(current_user, :push_code, project) - end + ::Gitlab::GitAccess.can_push_to_branch?(current_user, project, ref) end def edit_blob_link(project, ref, path, options = {}) |