diff options
author | Thibaut Girka <thib@sitedethib.com> | 2018-11-09 14:56:31 +0100 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2018-11-09 14:56:31 +0100 |
commit | 9201398507be60ee67c1b36d3763da800812af5b (patch) | |
tree | 31d63d5504e2041f0ad022a6181aaafeb273f6e7 /app/workers | |
parent | a2a254625b7b1a718038b0847e89dd3c20511197 (diff) | |
parent | ed7c5f94f7c8c062c3a931fd2cf4f37433c81c13 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/workers')
-rw-r--r-- | app/workers/local_notification_worker.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/app/workers/local_notification_worker.rb b/app/workers/local_notification_worker.rb index 748270563..48635e498 100644 --- a/app/workers/local_notification_worker.rb +++ b/app/workers/local_notification_worker.rb @@ -3,9 +3,16 @@ class LocalNotificationWorker include Sidekiq::Worker - def perform(mention_id) - mention = Mention.find(mention_id) - NotifyService.new.call(mention.account, mention) + 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 |