Files
fizzy/app/models/notification/push_target/web.rb
T
Rosa Gutierrez 3621df8f0f Consolidate push jobs into single Notification::PushJob
Replace separate WebPushJob and NativePushJob with a single PushJob
that calls notification.push, which iterates over registered targets.
Each target handles its own delivery - Web pushes synchronously via
the pool, Native enqueues device-level jobs via deliver_later_to.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-25 19:31:13 +01:00

15 lines
353 B
Ruby

class Notification::PushTarget::Web < Notification::PushTarget
private
def should_push?
super && subscriptions.any?
end
def perform_push
Rails.configuration.x.web_push_pool.queue(notification.payload.to_h, subscriptions)
end
def subscriptions
@subscriptions ||= notification.user.push_subscriptions
end
end