about summary refs log tree commit diff
path: root/app/workers
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2018-11-09 14:56:31 +0100
committerThibaut Girka <thib@sitedethib.com>2018-11-09 14:56:31 +0100
commit9201398507be60ee67c1b36d3763da800812af5b (patch)
tree31d63d5504e2041f0ad022a6181aaafeb273f6e7 /app/workers
parenta2a254625b7b1a718038b0847e89dd3c20511197 (diff)
parented7c5f94f7c8c062c3a931fd2cf4f37433c81c13 (diff)
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/workers')
-rw-r--r--app/workers/local_notification_worker.rb13
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