2016-01-27 15:59:16 +00:00
|
|
|
module Notes
|
|
|
|
class PostProcessService
|
|
|
|
attr_accessor :note
|
|
|
|
|
|
|
|
def initialize(note)
|
|
|
|
@note = note
|
|
|
|
end
|
|
|
|
|
|
|
|
def execute
|
|
|
|
# Skip system notes, like status changes and cross-references and awards
|
2016-06-01 09:23:09 +00:00
|
|
|
unless @note.system?
|
2016-01-27 15:59:16 +00:00
|
|
|
EventCreateService.new.leave_note(@note, @note.author)
|
2017-01-20 10:28:40 +00:00
|
|
|
|
|
|
|
return if @note.for_personal_snippet?
|
|
|
|
|
|
|
|
@note.create_cross_references!
|
|
|
|
execute_note_hooks
|
2016-01-27 15:59:16 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def hook_data
|
2016-08-12 08:09:29 +00:00
|
|
|
Gitlab::DataBuilder::Note.build(@note, @note.author)
|
2016-01-27 15:59:16 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def execute_note_hooks
|
|
|
|
note_data = hook_data
|
|
|
|
@note.project.execute_hooks(note_data, :note_hooks)
|
|
|
|
@note.project.execute_services(note_data, :note_hooks)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|