2013-03-26 12:11:38 -04:00
|
|
|
class NoteObserver < BaseObserver
|
2012-10-09 18:25:29 -04:00
|
|
|
def after_create(note)
|
2013-03-26 11:51:06 -04:00
|
|
|
notification.new_note(note)
|
2013-05-30 19:16:49 -04:00
|
|
|
|
2014-03-25 09:08:25 -04:00
|
|
|
# Skip system notes, like status changes and cross-references.
|
2014-06-13 07:24:54 -04:00
|
|
|
unless note.system
|
2014-06-10 10:56:35 -04:00
|
|
|
event_service.leave_note(note, note.author)
|
2014-03-25 09:08:25 -04:00
|
|
|
|
2013-05-30 19:16:49 -04:00
|
|
|
# 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
|
|
|
|
|
|
|
|
def after_update(note)
|
2014-06-10 10:56:35 -04:00
|
|
|
note.notice_added_references(note.project, note.author)
|
2012-10-13 16:46:27 -04:00
|
|
|
end
|
2012-10-09 18:25:29 -04:00
|
|
|
end
|