mirror of
https://github.com/sudoxnym/habitica-self-host.git
synced 2026-07-18 20:04:38 +00:00
fix(push notifications): remove tokens after a MismatchSenderId error
This commit is contained in:
parent
b947c714f0
commit
2888f843e3
1 changed files with 7 additions and 1 deletions
|
|
@ -92,7 +92,13 @@ export function sendNotification (user, details = {}) {
|
|||
// from when failed === NotRegistered
|
||||
// Blacklisted can happen in some rare cases,
|
||||
// see https://stackoverflow.com/questions/42136122/why-does-firebase-push-token-return-blacklisted
|
||||
if (failed === 'InvalidRegistration' || pushDevice.regId === 'BLACKLISTED') {
|
||||
// MismatchSenderId could be due to old tokens,
|
||||
// see https://stackoverflow.com/questions/11313342/why-do-i-get-mismatchsenderid-from-gcm-server-side
|
||||
if (
|
||||
failed === 'InvalidRegistration'
|
||||
|| failed === 'MismatchSenderId'
|
||||
|| pushDevice.regId === 'BLACKLISTED'
|
||||
) {
|
||||
removePushDevice(user, pushDevice);
|
||||
}
|
||||
logger.error(new Error('FCM error'), {
|
||||
|
|
|
|||
Loading…
Reference in a new issue