Commit 1aaa6095 authored by Douwe Maan's avatar Douwe Maan

Merge branch 'protected-branches-names' into 'master'

Only load branch names for protected branch checks

See merge request gitlab-org/gitlab-ce!15629
parents f2cd91dd a0527ab8
......@@ -10,7 +10,9 @@ class ProtectedBranch < ActiveRecord::Base
def self.protected?(project, ref_name)
return true if project.empty_repo? && default_branch_protected?
self.matching(ref_name, protected_refs: project.protected_branches).present?
refs = project.protected_branches.select(:name)
self.matching(ref_name, protected_refs: refs).present?
end
def self.default_branch_protected?
......
......@@ -5,6 +5,8 @@ class ProtectedTag < ActiveRecord::Base
protected_ref_access_levels :create
def self.protected?(project, ref_name)
self.matching(ref_name, protected_refs: project.protected_tags).present?
refs = project.protected_tags.select(:name)
self.matching(ref_name, protected_refs: refs).present?
end
end
---
title: Only load branch names for protected branch checks
merge_request:
author:
type: performance
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