Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 21:28:54 +0300
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 21:28:54 +0300
commit4f71c29c8bb35642ed5d26015619fc3f838f5e56 (patch)
treed70133356a4f6b3960688041bf87e94490731c45 /app/models/protected_branch.rb
parentbf3cc824e4ce6cf49a82210eaaf1cca06f7fd281 (diff)
Moved default_branch_protected? out of Project
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r--app/models/protected_branch.rb7
1 files changed, 6 insertions, 1 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index eca8d5e0f7d..0f0ac18b1a3 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -13,9 +13,14 @@ class ProtectedBranch < ActiveRecord::Base
# Check if branch name is marked as protected in the system
def self.protected?(project, ref_name)
- return true if project.empty_and_default_branch_protected?
+ return true if project.empty_repo? && default_branch_protected?
protected_refs = project.protected_branches_array
self.matching(ref_name, protected_refs: protected_refs).present?
end
+
+ def self.default_branch_protected?
+ current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_FULL ||
+ current_application_settings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE
+ end
end