summaryrefslogtreecommitdiff
path: root/lib/api/issues.rb
diff options
context:
space:
mode:
authortiagonbotelho <tiagonbotelho@hotmail.com>2016-08-18 11:24:44 +0100
committertiagonbotelho <tiagonbotelho@hotmail.com>2016-08-26 14:30:11 +0100
commit66b847607acfb51bdcdb691414e6ab9a4db13c20 (patch)
treea41a4e77fc4fb2187ad2f4c988bc7f5c875643e3 /lib/api/issues.rb
parentfa5d9e6d52e09679b8a636a60e3b21a12bb6d463 (diff)
downloadgitlab-ce-19721-issues-created-through-api-do-not-notify-label-subscribers.tar.gz
if issue is not valid we revert back to the old labels when updating19721-issues-created-through-api-do-not-notify-label-subscribers
Diffstat (limited to 'lib/api/issues.rb')
-rw-r--r--lib/api/issues.rb11
1 files changed, 2 insertions, 9 deletions
diff --git a/lib/api/issues.rb b/lib/api/issues.rb
index 39a46f69f16..d0bc7243e54 100644
--- a/lib/api/issues.rb
+++ b/lib/api/issues.rb
@@ -154,9 +154,7 @@ module API
render_api_error!({ labels: errors }, 400)
end
- # Find or create labels to attach to the issue. Labels are vaild
- # because we already checked its name, so there can't be an error here
- attrs[:label_ids] = get_label_ids(params[:labels]) if params[:labels].present?
+ attrs[:labels] = params[:labels] if params[:labels]
issue = ::Issues::CreateService.new(user_project, current_user, attrs.merge(request: request, api: true)).execute
@@ -198,12 +196,7 @@ module API
render_api_error!({ labels: errors }, 400)
end
- # Find or create labels and attach to issue. Labels are valid because
- # we already checked its name, so there can't be an error here
- if params[:labels] && can?(current_user, :admin_issue, user_project)
- issue.remove_labels
- attrs[:label_ids] = get_label_ids(params[:labels])
- end
+ attrs[:labels] = params[:labels] if params[:labels]
issue = ::Issues::UpdateService.new(user_project, current_user, attrs).execute(issue)