diff options
author | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-03 21:47:08 +0300 |
---|---|---|
committer | James Edwards-Jones <jedwardsjones@gitlab.com> | 2017-04-03 21:47:08 +0300 |
commit | 04a50bd9515e09d047d6f678c5d9485f89b31df7 (patch) | |
tree | 5b3dcd41f8174c3fdb6689488148617f92d0ca5f | |
parent | 4f71c29c8bb35642ed5d26015619fc3f838f5e56 (diff) |
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.
-rw-r--r-- | app/models/project.rb | 10 | ||||
-rw-r--r-- | app/models/protected_branch.rb | 3 | ||||
-rw-r--r-- | app/models/protected_tag.rb | 3 |
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 |