diff options
author | Douwe Maan <douwe@gitlab.com> | 2015-08-07 14:44:28 +0000 |
---|---|---|
committer | Douwe Maan <douwe@gitlab.com> | 2015-08-07 14:44:28 +0000 |
commit | 0d5d80b735eb18ae79eb2bfe26c08896d53db414 (patch) | |
tree | a2b8eea84efab23882c0840b225a1530f2245f88 /lib/api/notes.rb | |
parent | 9b6c513bf798db191314d6474ba25e2a22647711 (diff) | |
parent | ad55f0d6f9ec29026b36ee32ff5fc6081e3793de (diff) | |
download | gitlab-ce-0d5d80b735eb18ae79eb2bfe26c08896d53db414.tar.gz |
Merge branch 'comment-updated-by' into 'master'
Show who last edited a comment if it wasn't the original author
Fixes #1796.
The `updated_by` user is also tracked for issues and merge requests, but it isn't currently shown, because "edited by Person" would give the idea that Person edited the description, while most updates to those are assignee/milestone/labels, in which case who made that change is already visible in the comments.
See merge request !1075
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 |