diff options
author | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-15 15:56:43 +0200 |
---|---|---|
committer | Dmitriy Zaporozhets <dmitriy.zaporozhets@gmail.com> | 2015-10-15 15:56:43 +0200 |
commit | 353ddbc7958d55262233c850fd2af2d2df027863 (patch) | |
tree | bb004878b81da1aa5008124b416c34871eddc1b1 /lib | |
parent | 0d09b5fefc635120cf6e4234a401028f815fb326 (diff) | |
parent | 2df573dac3859034fcb90566a8ebc270a7e6088a (diff) | |
download | gitlab-ce-353ddbc7958d55262233c850fd2af2d2df027863.tar.gz |
Merge branch 'stanhu/gitlab-ce-fix-api-mr-comment-notifications'
Diffstat (limited to 'lib')
-rw-r--r-- | lib/api/merge_requests.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index f3a59fadf24..6eb84baf9cb 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -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 |