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:
authorJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 20:59:58 +0300
committerJames Edwards-Jones <jedwardsjones@gitlab.com>2017-04-03 21:19:54 +0300
commitbf3cc824e4ce6cf49a82210eaaf1cca06f7fd281 (patch)
tree04d422fe8b68079ef604348ffe96b1f2b72285ff /app/models/protected_tag.rb
parentb8c7bef5c092152ea85d1840e587cfc04293e1d7 (diff)
Moved Project#protected_branch? to ProtectedBranch, similar for tags
Diffstat (limited to 'app/models/protected_tag.rb')
-rw-r--r--app/models/protected_tag.rb5
1 files changed, 5 insertions, 0 deletions
diff --git a/app/models/protected_tag.rb b/app/models/protected_tag.rb
index 301fe2092e9..bca5522759d 100644
--- a/app/models/protected_tag.rb
+++ b/app/models/protected_tag.rb
@@ -7,4 +7,9 @@ class ProtectedTag < ActiveRecord::Base
validates :push_access_levels, length: { is: 1, message: "are restricted to a single instance per protected tag." }
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?
+ end
end