2016-04-02 18:10:28 +05:30
|
|
|
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-16 23:09:34 +05:30
|
|
|
unless @note.system?
|
2016-04-02 18:10:28 +05:30
|
|
|
EventCreateService.new.leave_note(@note, @note.author)
|
|
|
|
@note.create_cross_references!
|
|
|
|
execute_note_hooks
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def hook_data
|
2016-09-13 17:45:13 +05:30
|
|
|
Gitlab::DataBuilder::Note.build(@note, @note.author)
|
2016-04-02 18:10:28 +05:30
|
|
|
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
|