FIX: Delete push subscription on MismatchSenderId error

This should prevent repeated MismatchSenderId warnings when the VAPID keys have changed.
This commit is contained in:
Gerhard Schlager
2019-02-15 17:40:33 +01:00
parent 159dd69fcb
commit 17f1a76570

View File

@@ -88,6 +88,9 @@ class PushNotificationPusher
rescue Webpush::ExpiredSubscription rescue Webpush::ExpiredSubscription
unsubscribe(user, subscription) unsubscribe(user, subscription)
rescue Webpush::ResponseError => e rescue Webpush::ResponseError => e
if e.response.message == "MismatchSenderId"
unsubscribe(user, subscription)
else
Discourse.warn_exception( Discourse.warn_exception(
e, e,
message: "Failed to send push notification", message: "Failed to send push notification",
@@ -99,4 +102,5 @@ class PushNotificationPusher
) )
end end
end end
end
end end