From aeae1520068c54cb51dd3a350276df393ef43149 Mon Sep 17 00:00:00 2001 From: Emelia Smith Date: Mon, 11 Nov 2024 20:56:28 +0100 Subject: [PATCH] Prevent Web::Push notification delivery if notification is outside of TTL window (#32842) --- app/workers/web/push_notification_worker.rb | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/workers/web/push_notification_worker.rb b/app/workers/web/push_notification_worker.rb index 824e7b5940..3629904fa7 100644 --- a/app/workers/web/push_notification_worker.rb +++ b/app/workers/web/push_notification_worker.rb @@ -13,6 +13,8 @@ class Web::PushNotificationWorker @subscription = Web::PushSubscription.find(subscription_id) @notification = Notification.find(notification_id) + return if @notification.updated_at < TTL.ago + # Polymorphically associated activity could have been deleted # in the meantime, so we have to double-check before proceeding return unless @notification.activity.present? && @subscription.pushable?(@notification)