This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
2018-05-02 22:10:57 +02:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class LocalNotificationWorker
|
|
|
|
include Sidekiq::Worker
|
|
|
|
|
2018-11-08 21:05:42 +01:00
|
|
|
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)
|
2018-05-02 22:10:57 +02:00
|
|
|
rescue ActiveRecord::RecordNotFound
|
|
|
|
true
|
|
|
|
end
|
|
|
|
end
|