Prevent Web::Push notification delivery if notification is outside of TTL window (#32842)

pull/2898/head
Emelia Smith 2024-11-11 20:56:28 +01:00 committed by GitHub
parent c78dc23b49
commit aeae152006
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 0 deletions

View File

@ -13,6 +13,8 @@ class Web::PushNotificationWorker
@subscription = Web::PushSubscription.find(subscription_id) @subscription = Web::PushSubscription.find(subscription_id)
@notification = Notification.find(notification_id) @notification = Notification.find(notification_id)
return if @notification.updated_at < TTL.ago
# Polymorphically associated activity could have been deleted # Polymorphically associated activity could have been deleted
# in the meantime, so we have to double-check before proceeding # in the meantime, so we have to double-check before proceeding
return unless @notification.activity.present? && @subscription.pushable?(@notification) return unless @notification.activity.present? && @subscription.pushable?(@notification)