feat(questions): wire pruneDeadTokens into onAnswerWritten
This commit is contained in:
parent
9ca9f19c51
commit
8b3356e60d
|
|
@ -1,6 +1,7 @@
|
||||||
import * as functions from 'firebase-functions'
|
import * as functions from 'firebase-functions'
|
||||||
import * as admin from 'firebase-admin'
|
import * as admin from 'firebase-admin'
|
||||||
import { recipientInQuietHours } from '../notifications/quietHours'
|
import { recipientInQuietHours } from '../notifications/quietHours'
|
||||||
|
import { pruneDeadTokens } from '../notifications/pruneTokens'
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Firestore trigger that sends an FCM notification to the other partner when
|
* Firestore trigger that sends an FCM notification to the other partner when
|
||||||
|
|
@ -142,6 +143,8 @@ export const onAnswerWritten = functions.firestore
|
||||||
console.error(`[onAnswerWritten] some notifications failed:`, failures)
|
console.error(`[onAnswerWritten] some notifications failed:`, failures)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
await pruneDeadTokens(db, partnerId, tokens, sendResults)
|
||||||
|
|
||||||
// Track last activity time on the couple doc for re-engagement targeting.
|
// Track last activity time on the couple doc for re-engagement targeting.
|
||||||
await db.collection('couples').doc(coupleId).update({
|
await db.collection('couples').doc(coupleId).update({
|
||||||
lastAnsweredAt: admin.firestore.FieldValue.serverTimestamp(),
|
lastAnsweredAt: admin.firestore.FieldValue.serverTimestamp(),
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue