2018-06-27 03:23:28 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-01-27 10:59:16 -05:00
|
|
|
class NewNoteWorker
|
2017-11-28 11:08:30 -05:00
|
|
|
include ApplicationWorker
|
2016-01-27 10:59:16 -05:00
|
|
|
|
2016-11-19 13:18:44 -05:00
|
|
|
# Keep extra parameter to preserve backwards compatibility with
|
|
|
|
# old `NewNoteWorker` jobs (can remove later)
|
|
|
|
def perform(note_id, _params = {})
|
2016-10-13 11:26:44 -04:00
|
|
|
if note = Note.find_by(id: note_id)
|
2018-05-03 17:32:20 -04:00
|
|
|
NotificationService.new.new_note(note)
|
2016-10-13 11:26:44 -04:00
|
|
|
Notes::PostProcessService.new(note).execute
|
|
|
|
else
|
|
|
|
Rails.logger.error("NewNoteWorker: couldn't find note with ID=#{note_id}, skipping job")
|
|
|
|
end
|
2016-01-27 10:59:16 -05:00
|
|
|
end
|
|
|
|
end
|