2016-01-27 15:59:16 +00:00
|
|
|
class NewNoteWorker
|
2017-11-28 16:08:30 +00:00
|
|
|
include ApplicationWorker
|
2016-01-27 15:59:16 +00:00
|
|
|
|
2016-11-19 18:18:44 +00:00
|
|
|
# Keep extra parameter to preserve backwards compatibility with
|
|
|
|
# old `NewNoteWorker` jobs (can remove later)
|
|
|
|
def perform(note_id, _params = {})
|
2016-10-13 15:26:44 +00:00
|
|
|
if note = Note.find_by(id: note_id)
|
2018-03-30 17:27:03 +00:00
|
|
|
NotificationService.new.new_note(note) if note.can_create_notification?
|
2016-10-13 15:26:44 +00: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 15:59:16 +00:00
|
|
|
end
|
|
|
|
end
|