diff options
author | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-18 11:24:44 +0100 |
---|---|---|
committer | tiagonbotelho <tiagonbotelho@hotmail.com> | 2016-08-30 18:39:03 +0100 |
commit | 76c2901eac89b1b3a9975ec0f91fb929fbed2e70 (patch) | |
tree | a03cffd8301ba05ca323cc0aa9d954dcd042e321 /lib/api/issues.rb | |
parent | 7f0bcf04323ad69b64a90112896971ea8d1a5f99 (diff) | |
download | gitlab-ce-76c2901eac89b1b3a9975ec0f91fb929fbed2e70.tar.gz |
if issue is not valid we revert back to the old labels when updating
Diffstat (limited to 'lib/api/issues.rb')
-rw-r--r-- | lib/api/issues.rb | 11 |
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) |