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:
-rw-r--r--app/models/project.rb10
-rw-r--r--app/models/protected_branch.rb3
-rw-r--r--app/models/protected_tag.rb3
3 files changed, 2 insertions, 14 deletions
diff --git a/app/models/project.rb b/app/models/project.rb
index fdb0a679e28..13c5c181cc5 100644
--- a/app/models/project.rb
+++ b/app/models/project.rb
@@ -883,16 +883,6 @@ class Project < ActiveRecord::Base
"#{url}.git"
end
- #TODO: Check with if this is still needed, maybe because of `.select {` in ProtectedRefsMatcher
- #Either with tests or by asking Tim
- def protected_tags_array
- @protected_tags_array ||= self.protected_tags.to_a
- end
-
- def protected_branches_array
- @protected_branches_array ||= self.protected_branches.to_a
- end
-
def user_can_push_to_empty_repo?(user)
!ProtectedBranch.default_branch_protected? || team.max_member_access(user.id) > Gitlab::Access::DEVELOPER
end
diff --git a/app/models/protected_branch.rb b/app/models/protected_branch.rb
index 0f0ac18b1a3..28b7d5ad072 100644
--- a/app/models/protected_branch.rb
+++ b/app/models/protected_branch.rb
@@ -15,8 +15,7 @@ class ProtectedBranch < ActiveRecord::Base
def self.protected?(project, ref_name)
return true if project.empty_repo? && default_branch_protected?
- protected_refs = project.protected_branches_array
- self.matching(ref_name, protected_refs: protected_refs).present?
+ self.matching(ref_name, protected_refs: project.protected_branches).present?
end
def self.default_branch_protected?
diff --git a/app/models/protected_tag.rb b/app/models/protected_tag.rb
index bca5522759d..a52fe90bb2b 100644
--- a/app/models/protected_tag.rb
+++ b/app/models/protected_tag.rb
@@ -9,7 +9,6 @@ class ProtectedTag < ActiveRecord::Base
accepts_nested_attributes_for :push_access_levels
def self.protected?(project, ref_name)
- protected_refs = project.protected_tags_array
- self.matching(ref_name, protected_refs: protected_refs).present?
+ self.matching(ref_name, protected_refs: project.protected_tags).present?
end
end