feat(questions): wire pruneDeadTokens into onAnswerRevealed
This commit is contained in:
parent
13c0769efb
commit
9ca9f19c51
|
|
@ -1,6 +1,7 @@
|
|||
import * as functions from 'firebase-functions'
|
||||
import * as admin from 'firebase-admin'
|
||||
import { recipientInQuietHours } from '../notifications/quietHours'
|
||||
import { pruneDeadTokens } from '../notifications/pruneTokens'
|
||||
|
||||
/**
|
||||
* Firestore trigger: when one partner OPENS (reveals) the shared answers — i.e. their own
|
||||
|
|
@ -107,6 +108,7 @@ export const onAnswerRevealed = functions.firestore
|
|||
if (r.status === 'rejected') failures.push(`${tokens[i]}: ${String(r.reason)}`)
|
||||
})
|
||||
if (failures.length > 0) console.error('[onAnswerRevealed] some notifications failed:', failures)
|
||||
await pruneDeadTokens(db, partnerId, tokens, sendResults)
|
||||
|
||||
console.log(`[onAnswerRevealed] notified ${partnerId} that ${userId} opened couple ${coupleId}`)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in New Issue