about summary refs log tree commit diff
path: root/app/services/notify_service.rb
diff options
context:
space:
mode:
authorOndřej Hruška <ondra@ondrovo.com>2017-07-18 18:58:47 +0200
committerOndřej Hruška <ondra@ondrovo.com>2017-07-18 18:58:47 +0200
commitd69fa9e1f40124279ec9d772e5f54d1e11724e2d (patch)
treeef0462e5fcc8cc7962ef42d80f7dd520a574a7c5 /app/services/notify_service.rb
parentc727eae4412ac9e4f1bafdc68fe89dcd46d602ca (diff)
parent0b4006fc47dcd3d57ffdd0b95c95ad4c40a4918f (diff)
Merge changes from upstream with the CSS reload fix
Diffstat (limited to 'app/services/notify_service.rb')
-rw-r--r--app/services/notify_service.rb6
1 files changed, 5 insertions, 1 deletions
diff --git a/app/services/notify_service.rb b/app/services/notify_service.rb
index 0ab61b634..c7d8ad50a 100644
--- a/app/services/notify_service.rb
+++ b/app/services/notify_service.rb
@@ -65,7 +65,11 @@ class NotifyService < BaseService
   end
 
   def send_push_notifications
-    WebPushNotificationWorker.perform_async(@recipient.id, @notification.id)
+    sessions_with_subscriptions_ids = @recipient.user.session_activations.where.not(web_push_subscription: nil).pluck(:id)
+
+    WebPushNotificationWorker.push_bulk(sessions_with_subscriptions_ids) do |session_activation_id|
+      [session_activation_id, @notification.id]
+    end
   end
 
   def send_email