Files
archived-chatwoot/spec/factories/notification_subscriptions.rb
Pranav ee2844877c fix: Add catch for additional webpush errors (#9662)
Webpush gem throws errors such as `WebPush::ExpiredSubscription`,
`WebPush::InvalidSubscription`, `WebPush::Unauthorized`. We handled only
ExpiredSubscription.

If the SDK threw any other errors, it would pause sending the
notification to all other devices for that user. This change would
update the logic to remove the expired subscription and handle the rest
of the errors gracefully.

Fixes
https://linear.app/chatwoot/issue/CW-3399/webpushinvalidsubscription-host-fcmgoogleapiscom-nethttpnotfound-404
2024-06-21 14:58:36 -07:00

19 lines
385 B
Ruby

# frozen_string_literal: true
FactoryBot.define do
factory :notification_subscription do
user
identifier { 'test' }
subscription_type { 'browser_push' }
subscription_attributes { { endpoint: 'test', auth: 'test' } }
trait :browser_push do
subscription_type { 'browser_push' }
end
trait :fcm do
subscription_type { 'fcm' }
end
end
end