feat(questions): wire pruneDeadTokens into onAnswerRevealed

This commit is contained in:
null 2026-06-30 23:35:20 -05:00
parent 13c0769efb
commit 9ca9f19c51
1 changed files with 2 additions and 0 deletions

View File

@ -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}`)
})