Read about our upcoming Code of Conduct on this issue

Commit 04a50bd9 authored by James Edwards-Jones's avatar James Edwards-Jones
Browse files

Removed protected_tags_array

This memorized array appears to originally come from https://gitlab.com/gitlab-org/gitlab-ee/commit/19c2c90ccac86a21eb4266b9a5972162f917f692 which has a commit message of ‘fix warnings’. Without any comments on the original pull request I think we can safely get rid of it unless warnings re-appear.
parent d4a6525fb569
......@@ -883,16 +883,6 @@ def http_url_to_repo(user = nil)
"#{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
......
......@@ -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?
......
......@@ -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
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