Gab Social. All are welcome.
This commit is contained in:
19
app/workers/local_notification_worker.rb
Normal file
19
app/workers/local_notification_worker.rb
Normal file
@@ -0,0 +1,19 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
class LocalNotificationWorker
|
||||
include Sidekiq::Worker
|
||||
|
||||
def perform(receiver_account_id, activity_id = nil, activity_class_name = nil)
|
||||
if activity_id.nil? && activity_class_name.nil?
|
||||
activity = Mention.find(receiver_account_id)
|
||||
receiver = activity.account
|
||||
else
|
||||
receiver = Account.find(receiver_account_id)
|
||||
activity = activity_class_name.constantize.find(activity_id)
|
||||
end
|
||||
|
||||
NotifyService.new.call(receiver, activity)
|
||||
rescue ActiveRecord::RecordNotFound
|
||||
true
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user