feat(couples): wire pruneDeadTokens into acceptInviteCallable
This commit is contained in:
parent
f55c49010d
commit
355edd0887
|
|
@ -1,5 +1,6 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { pruneDeadTokens } from '../notifications/pruneTokens'
|
||||
|
||||
/**
|
||||
* HTTPS callable that mediates invite acceptance.
|
||||
|
|
@ -191,7 +192,7 @@ async function notifyPartnerJoined(
|
|||
const tokens = await getUserTokens(db, inviterUserId)
|
||||
if (tokens.length === 0) return
|
||||
|
||||
await Promise.allSettled(
|
||||
const results = await Promise.allSettled(
|
||||
tokens.map((token) =>
|
||||
admin.messaging().send({
|
||||
token,
|
||||
|
|
@ -207,6 +208,7 @@ async function notifyPartnerJoined(
|
|||
})
|
||||
)
|
||||
)
|
||||
await pruneDeadTokens(db, inviterUserId, tokens, results)
|
||||
}
|
||||
|
||||
async function getUserTokens(
|
||||
|
|
|
|||
Loading…
Reference in New Issue