diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-07-30 14:45:54 +0200 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-07-30 14:45:54 +0200 |
commit | 36bd6c8494d4d1deb09f749a02aa9981c8d3080f (patch) | |
tree | 697f887f318c60bc8731173d7bc2ecdfdc7349e4 /lib/api/notes.rb | |
parent | a06827bff934a7b387dc4280a555e0c81cc06604 (diff) | |
download | gitlab-ce-36bd6c8494d4d1deb09f749a02aa9981c8d3080f.tar.gz |
Show who last edited a comment if it wasn't the original author
Diffstat (limited to 'lib/api/notes.rb')
-rw-r--r-- | lib/api/notes.rb | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 3726be7c537..3efdfe2d46e 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -78,17 +78,15 @@ module API put ":id/#{noteables_str}/:#{noteable_id_str}/notes/:note_id" do required_attributes! [:body] - authorize! :admin_note, user_project.notes.find(params[:note_id]) + note = user_project.notes.find(params[:note_id]) + + authorize! :admin_note, note opts = { - note: params[:body], - note_id: params[:note_id], - noteable_type: noteables_str.classify, - noteable_id: params[noteable_id_str] + note: params[:body] } - @note = ::Notes::UpdateService.new(user_project, current_user, - opts).execute + @note = ::Notes::UpdateService.new(user_project, current_user, opts).execute(note) if @note.valid? present @note, with: Entities::Note |