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:
Diffstat (limited to 'app/models/protected_branch.rb')
-rw-r--r--app/models/protected_branch.rb12
1 files changed, 10 insertions, 2 deletions
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index a411cb417e2..b0fde6c6c1b 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -5,13 +5,21 @@ class ProtectedBranch < ActiveRecord::Base
validates :name, presence: true
validates :project, presence: true
- has_one :merge_access_level
- has_one :push_access_level
+ has_one :merge_access_level, dependent: :destroy
+ has_one :push_access_level, dependent: :destroy
def commit
project.commit(self.name)
end
+ def developers_can_push
+ self.push_access_level && self.push_access_level.developers?
+ end
+
+ def developers_can_merge
+ self.merge_access_level && self.merge_access_level.developers?
+ end
+
# Returns all protected branches that match the given branch name.
# This realizes all records from the scope built up so far, and does
# _not_ return a relation.