diff options
author | uran <uran@zeoalliance.com> | 2014-09-02 19:12:13 +0400 |
---|---|---|
committer | yglukhov <yuriy.glukhov@gmail.com> | 2014-12-25 15:28:40 +0300 |
commit | 1fbc01024123c44740e1c94cab5a74faf2856a21 (patch) | |
tree | 2bb5982d2a0ed22e7caf8cc5b6e5e87b6d1abe13 /app/services/notes/update_service.rb | |
parent | fe104386b16a73cbac1588aa5cce8319c6355ee9 (diff) |
Implemented notes (body) patching in API.
Diffstat (limited to 'app/services/notes/update_service.rb')
-rw-r--r-- | app/services/notes/update_service.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/app/services/notes/update_service.rb b/app/services/notes/update_service.rb new file mode 100644 index 00000000000..63431b82471 --- /dev/null +++ b/app/services/notes/update_service.rb @@ -0,0 +1,25 @@ +module Notes + class UpdateService < BaseService + def execute + note = project.notes.find(params[:note_id]) + note.note = params[:note] + if note.save + notification_service.new_note(note) + + # Skip system notes, like status changes and cross-references. + unless note.system + event_service.leave_note(note, note.author) + + # Create a cross-reference note if this Note contains GFM that + # names an issue, merge request, or commit. + note.references.each do |mentioned| + Note.create_cross_reference_note(mentioned, note.noteable, + note.author, note.project) + end + end + end + + note + end + end +end |