diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 14:43:46 +0300 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2014-05-13 14:43:46 +0300 |
commit | 1f1c59b61d30b76d69f0f925b43a0b96465f38ed (patch) | |
tree | 3e77115afc63a5d571798d4dda23f9f30e0a49b5 /lib | |
parent | 0c621708658da4b3cf88d805da5dbad920f3d27f (diff) | |
parent | 5f25cdfe19c7c0a8c1ada592307e9017e2a754e1 (diff) | |
download | gitlab-ce-1f1c59b61d30b76d69f0f925b43a0b96465f38ed.tar.gz |
Merge pull request #6778 from dblessing/feature/mr_labels
Merge Request Labels
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/entities.rb | 1 | ||||
-rw-r--r-- | lib/api/merge_requests.rb | 4 |
2 files changed, 5 insertions, 0 deletions
diff --git a/lib/api/entities.rb b/lib/api/entities.rb index c1bd6d02c68..457af52fe9d 100644 --- a/lib/api/entities.rb +++ b/lib/api/entities.rb @@ -136,6 +136,7 @@ module API expose :target_branch, :source_branch, :upvotes, :downvotes expose :author, :assignee, using: Entities::UserBasic expose :source_project_id, :target_project_id + expose :label_list, as: :labels end class SSHKey < Grape::Entity diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 7fb135b37b8..017cb1f562e 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) |