diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 15:07:57 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-02 15:07:57 +0300 |
commit | 988b28ec1a379d38f6ac9ed04886ee564fd447fd (patch) | |
tree | 9d93267209387e62d23ea7abf81ef9c0d64f2f0b /app/models/protected_branch.rb | |
parent | a325f3a104748ecc68df7c3d793940aa709a111f (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r-- | app/models/protected_branch.rb | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb index 94c3b83564f..594c822c18f 100644 --- a/app/models/protected_branch.rb +++ b/app/models/protected_branch.rb @@ -11,7 +11,8 @@ class ProtectedBranch < ApplicationRecord def self.protected_ref_accessible_to?(ref, user, project:, action:, protected_refs: nil) # Maintainers, owners and admins are allowed to create the default branch - if default_branch_protected? && project.empty_repo? + + if project.empty_repo? && project.default_branch_protected? return true if user.admin? || project.team.max_member_access(user.id) > Gitlab::Access::DEVELOPER end @@ -20,7 +21,7 @@ class ProtectedBranch < ApplicationRecord # Check if branch name is marked as protected in the system def self.protected?(project, ref_name) - return true if project.empty_repo? && default_branch_protected? + return true if project.empty_repo? && project.default_branch_protected? self.matching(ref_name, protected_refs: protected_refs(project)).present? end @@ -33,11 +34,6 @@ class ProtectedBranch < ApplicationRecord end end - def self.default_branch_protected? - Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_FULL || - Gitlab::CurrentSettings.default_branch_protection == Gitlab::Access::PROTECTION_DEV_CAN_MERGE - end - def self.protected_refs(project) project.protected_branches end |