summaryrefslogtreecommitdiff
path: root/lib/api/helpers.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/api/helpers.rb')
-rw-r--r--lib/api/helpers.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/api/helpers.rb b/lib/api/helpers.rb
index da4b1bf9902..dbad86d8926 100644
--- a/lib/api/helpers.rb
+++ b/lib/api/helpers.rb
@@ -102,6 +102,14 @@ module API
label || not_found!('Label')
end
+ def get_label_ids(labels)
+ labels.split(",").map do |label_name|
+ user_project.labels.create_with(color: Label::DEFAULT_COLOR)
+ .find_or_create_by(title: label_name.strip)
+ .id
+ end
+ end
+
def find_project_issue(id)
issue = user_project.issues.find(id)
not_found! unless can?(current_user, :read_issue, issue)