diff options
author | Han Loong Liauw <hanloongliauw@gmail.com> | 2015-10-17 09:32:31 +1100 |
---|---|---|
committer | Han Loong Liauw <hanloongliauw@gmail.com> | 2015-10-17 09:32:31 +1100 |
commit | 02e8beaa0b83a343752ebf60e4fca4482c17f9e3 (patch) | |
tree | e00847b274daa7fa03fd7a4647154cc2e4d98e85 /lib/api/merge_requests.rb | |
parent | 0bea5ced8bf4c9306f8f8e912313731a43d16f4c (diff) | |
parent | c856a7a5934fba13598be09507c2090888f57a39 (diff) | |
download | gitlab-ce-02e8beaa0b83a343752ebf60e4fca4482c17f9e3.tar.gz |
Merge branch 'master' into remove-forks-from-projects-settings
Diffstat (limited to 'lib/api/merge_requests.rb')
-rw-r--r-- | lib/api/merge_requests.rb | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index 63ea2f05438..6eb84baf9cb 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -99,7 +99,7 @@ module API # id (required) - The ID of a project - this will be the source of the merge request # source_branch (required) - The source branch # target_branch (required) - The target branch - # target_project - The target project of the merge request defaults to the :id of the project + # target_project_id - The target project of the merge request defaults to the :id of the project # assignee_id - Assignee user ID # title (required) - Title of MR # description - Description of MR @@ -249,8 +249,16 @@ module API required_attributes! [:note] merge_request = user_project.merge_requests.find(params[:merge_request_id]) - note = merge_request.notes.new(note: params[:note], project_id: user_project.id) - note.author = current_user + + authorize! :create_note, merge_request + + opts = { + note: params[:note], + noteable_type: 'MergeRequest', + noteable_id: merge_request.id + } + + note = ::Notes::CreateService.new(user_project, current_user, opts).execute if note.save present note, with: Entities::MRNote |