06c9ece058
The notification now owns its payload via #payload method in Pushable, allowing direct access like notification.payload.title. Push classes simply use the notification's payload rather than building it themselves. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
19 lines
441 B
Ruby
19 lines
441 B
Ruby
class Notification::Push::Web < Notification::Push
|
|
def self.push_later(notification)
|
|
Notification::WebPushJob.perform_later(notification)
|
|
end
|
|
|
|
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
|