2019-07-02 08:10:25 +01:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class LocalNotificationWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2021-02-05 18:25:46 +00:00
|
|
|
sidekiq_options queue: 'default', retry: 3
|
|
|
|
|
2019-07-02 08:10:25 +01:00
|
|
|
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
|
2021-02-01 08:43:56 +00:00
|
|
|
return true if activity_id.nil? or activity_class_name.nil?
|
|
|
|
|
|
|
|
receiver = Account.find(receiver_account_id)
|
|
|
|
activity = activity_class_name.constantize.find(activity_id)
|
2019-07-02 08:10:25 +01:00
|
|
|
|
|
|
|
NotifyService.new.call(receiver, activity)
|
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|