]> cat aescling's git repositories - mastodon.git/commitdiff
fix(web_push_notification_worker): Guard against deleted notifications (#4379)
authorSorin Davidoi <sorin.davidoi@gmail.com>
Wed, 26 Jul 2017 14:14:39 +0000 (16:14 +0200)
committerEugen Rochko <eugen@zeonfederated.com>
Wed, 26 Jul 2017 14:14:39 +0000 (16:14 +0200)
app/workers/web_push_notification_worker.rb

index da4043ddbd82a54811b2e901717db06a8dff021b..51b8daae7c192969fff3cad044d4d2ed638ba2b0 100644 (file)
@@ -9,6 +9,8 @@ class WebPushNotificationWorker
     session_activation = SessionActivation.find(session_activation_id)
     notification = Notification.find(notification_id)
 
+    return if session_activation.nil? || notification.nil?
+
     begin
       session_activation.web_push_subscription.push(notification)
     rescue Webpush::InvalidSubscription, Webpush::ExpiredSubscription => e