summaryrefslogtreecommitdiff
path: root/lib/api/merge_requests.rb
diff options
context:
space:
mode:
authorDrew Blessing <drew.blessing@me.com>2014-04-14 20:12:07 -0500
committerDrew Blessing <drew.blessing@me.com>2014-05-13 06:41:36 -0500
commit5f25cdfe19c7c0a8c1ada592307e9017e2a754e1 (patch)
tree82e2dde5c25c8dc9b6fa56dc1f2440910b2c1412 /lib/api/merge_requests.rb
parent172ad9624599647df5682f7f2a9d2d74d947d068 (diff)
downloadgitlab-ce-5f25cdfe19c7c0a8c1ada592307e9017e2a754e1.tar.gz
Implement Merge Request Labels
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r--lib/api/merge_requests.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb
index 4b88b0f84c1..5fac2a3ea19 100644
--- a/lib/api/merge_requests.rb
+++ b/lib/api/merge_requests.rb
@@ -67,6 +67,7 @@ module API
# assignee_id - Assignee user ID
# title (required) - Title of MR
# description - Description of MR
+ # labels (optional) - Labels for MR as a comma-separated list
#
# Example:
# POST /projects/:id/merge_requests
@@ -75,6 +76,7 @@ module API
authorize! :write_merge_request, user_project
required_attributes! [:source_branch, :target_branch, :title]
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :target_project_id, :description]
+ attrs[:label_list] = params[:labels] if params[:labels].present?
merge_request = ::MergeRequests::CreateService.new(user_project, current_user, attrs).execute
if merge_request.valid?
@@ -95,11 +97,13 @@ module API
# title - Title of MR
# state_event - Status of MR. (close|reopen|merge)
# description - Description of MR
+ # labels (optional) - Labels for a MR as a comma-separated list
# Example:
# PUT /projects/:id/merge_request/:merge_request_id
#
put ":id/merge_request/:merge_request_id" do
attrs = attributes_for_keys [:source_branch, :target_branch, :assignee_id, :title, :state_event, :description]
+ attrs[:label_list] = params[:labels] if params[:labels].present?
merge_request = user_project.merge_requests.find(params[:merge_request_id])
authorize! :modify_merge_request, merge_request
merge_request = ::MergeRequests::UpdateService.new(user_project, current_user, attrs).execute(merge_request)