diff options
author | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-20 20:34:55 +0200 |
---|---|---|
committer | Robert Schilling <rschilling@student.tugraz.at> | 2014-08-20 20:34:55 +0200 |
commit | 66f6ca0770fa91a3763d45f8c1d2194d95b3c67b (patch) | |
tree | 312692802280b57829b5145f8bded20a9ca75914 /lib/api/merge_requests.rb | |
parent | 87efd92d8cc378697359012226d2679cab7e1e9e (diff) | |
download | gitlab-ce-66f6ca0770fa91a3763d45f8c1d2194d95b3c67b.tar.gz |
Fix tests after #7526
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r-- | lib/api/merge_requests.rb | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 0d765f9280e..8726379bf3c 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -78,8 +78,8 @@ module API attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description] # Validate label names in advance - if validate_label_params(params) - return render_api_error!('Label names invalid', 405) + if (errors = validate_label_params(params)).any? + render_api_error!({ labels: errors }, 400) end merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute @@ -117,15 +117,16 @@ module API authorize! :modify_merge_request, merge_request # Validate label names in advance - if validate_label_params(params) - return render_api_error!('Label names invalid', 405) + if (errors = validate_label_params(params)).any? + render_api_error!({ labels: errors }, 400) end merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request) if merge_request.valid? # Find or create labels and attach to issue - if params[:labels].present? + unless params[:labels].nil? + merge_request.remove_labels merge_request.add_labels_by_names(params[:labels].split(",")) end |