summaryrefslogtreecommitdiff
path: root/app/models/concerns
diff options
context:
space:
mode:
authorDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 17:17:29 +0300
committerDmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>2014-07-30 17:17:29 +0300
commitd9d8d3b7995c351cb4a7d91718f3f48324bd099a (patch)
tree9a58e84761207777f08d5c33ee1d9a69da74170e /app/models/concerns
parent70f868b737af99c8a8697a3cb5e19b8da3d9c3d9 (diff)
downloadgitlab-ce-d9d8d3b7995c351cb4a7d91718f3f48324bd099a.tar.gz
Fix old api compatibility and tests
Signed-off-by: Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com>
Diffstat (limited to 'app/models/concerns')
-rw-r--r--app/models/concerns/issuable.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/concerns/issuable.rb b/app/models/concerns/issuable.rb
index f260198547e..517e4548624 100644
--- a/app/models/concerns/issuable.rb
+++ b/app/models/concerns/issuable.rb
@@ -133,4 +133,15 @@ module Issuable
object_attributes: self.attributes
}
end
+
+ def label_names
+ labels.order('title ASC').pluck(:title)
+ end
+
+ def add_labels_by_names(label_names)
+ label_names.each do |label_name|
+ label = project.labels.find_or_create_by(title: label_name.strip)
+ self.labels << label
+ end
+ end
end