3621df8f0f
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>
15 lines
353 B
Ruby
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
|