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:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-09-19 23:21:39 +0300
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 19:58:24 +0300
commit398ab263fd08a5d9d7b19c5b3d06f33814a474eb (patch)
tree5a7249f72bdec65e87abb597f22a68afa9fb9f74 /app/models/label.rb
parentd5a595b59702489c0b1026a0951157b8cfd3d65c (diff)
Allow users to apply group labels on Issues/MRs
Diffstat (limited to 'app/models/label.rb')
-rw-r--r--app/models/label.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/models/label.rb b/app/models/label.rb
index e8e12e2904e..295c5bfaf70 100644
--- a/app/models/label.rb
+++ b/app/models/label.rb
@@ -23,7 +23,7 @@ class Label < ActiveRecord::Base
has_many :merge_requests, through: :label_links, source: :target, source_type: 'MergeRequest'
validates :color, color: true, allow_blank: false
- validates :project, presence: true, unless: Proc.new { |service| service.template? }
+ validates :project, presence: true, if: :project_label?
# Don't allow ',' for label titles
validates :title,
@@ -127,6 +127,10 @@ class Label < ActiveRecord::Base
private
+ def project_label?
+ type.blank? && !template?
+ end
+
def label_format_reference(format = :id)
raise StandardError, 'Unknown format' unless [:id, :name].include?(format)