Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib/api
diff options
context:
space:
mode:
authorRobert Schilling <rschilling@student.tugraz.at>2014-08-20 22:34:55 +0400
committerRobert Schilling <rschilling@student.tugraz.at>2014-08-20 22:34:55 +0400
commit66f6ca0770fa91a3763d45f8c1d2194d95b3c67b (patch)
tree312692802280b57829b5145f8bded20a9ca75914 /lib/api
parent87efd92d8cc378697359012226d2679cab7e1e9e (diff)
Fix tests after #7526
Diffstat (limited to 'lib/api')
-rw-r--r--lib/api/merge_requests.rb11
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