summaryrefslogtreecommitdiff
path: root/app/services/labels
diff options
context:
space:
mode:
authorDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-18 00:27:10 -0200
committerDouglas Barbosa Alexandre <dbalexandre@gmail.com>2016-10-19 14:58:27 -0200
commitd009d38ed6ab5459f596194ce808c304e6379161 (patch)
tree4e48d7971255807c008d7c5ff1ade48a92b192af /app/services/labels
parent6c189dcc8e76d5ddb348832500b003bf0d1b49a6 (diff)
downloadgitlab-ce-d009d38ed6ab5459f596194ce808c304e6379161.tar.gz
User Labes::CreateService to create labels
Diffstat (limited to 'app/services/labels')
-rw-r--r--app/services/labels/transfer_service.rb8
1 files changed, 2 insertions, 6 deletions
diff --git a/app/services/labels/transfer_service.rb b/app/services/labels/transfer_service.rb
index 559d2860d97..65b4bdbaff9 100644
--- a/app/services/labels/transfer_service.rb
+++ b/app/services/labels/transfer_service.rb
@@ -41,13 +41,9 @@ module Labels
LabelLink.where("label_links.id IN (#{union.to_sql})")
end
- def labels
- @labels ||= LabelsFinder.new(current_user, project_id: project.id).execute
- end
-
def find_or_create_label!(label)
- new_label = labels.find_by(title: label.title)
- new_label ||= project.labels.create!(label.attributes.slice("title", "description", "color"))
+ params = label.attributes.slice('title', 'description', 'color')
+ new_label = CreateService.new(current_user, project, params).execute
new_label.id
end