Merge pull request #1435 from omnivore-app/disable-push-notification-reminder

Disable push notification reminders
This commit is contained in:
Hongbo Wu
2022-11-22 10:41:12 +08:00
committed by GitHub
2 changed files with 14 additions and 16 deletions

View File

@ -5,8 +5,6 @@ import { kx } from '../../datalayer/knex_config'
import { setClaims } from '../../datalayer/helpers'
import { sendEmail } from '../../utils/sendEmail'
import { env, homePageURL } from '../../env'
import { sendMulticastPushNotifications } from '../../utils/sendNotification'
import { getDeviceTokensByUserId } from '../../services/user_device_tokens'
import { MulticastMessage } from 'firebase-admin/messaging'
import { UserDeviceToken } from '../../entity/user_device_tokens'
import { ContentReader } from '../../generated/graphql'
@ -108,19 +106,19 @@ export function remindersServiceRouter() {
to: user.email,
})
// send push notifications
const deviceTokens = await getDeviceTokensByUserId(userId)
if (deviceTokens && deviceTokens.length > 0) {
const message = messageForPages(pageReminders, deviceTokens)
await sendMulticastPushNotifications(userId, message, 'reminder')
}
if (!deviceTokens) {
console.log('Device tokens not set:', userId)
res.status(400).send('Device token Not Found')
return
}
// // send push notifications
// const deviceTokens = await getDeviceTokensByUserId(userId)
// if (deviceTokens && deviceTokens.length > 0) {
// const message = messageForPages(pageReminders, deviceTokens)
// await sendMulticastPushNotifications(userId, message, 'reminder')
// }
//
// if (!deviceTokens) {
// console.log('Device tokens not set:', userId)
//
// res.status(400).send('Device token Not Found')
// return
// }
}
await updateRemindersStatus(models, userId, pagesToUnarchive, remindAt)

View File

@ -99,7 +99,7 @@ export const ruleHandler = Sentry.GCPFunction.wrapHttpFunction(
}
if (type !== EntityType.PAGE) {
console.log('Not a page update')
console.log('Not a page')
res.status(200).send('Not Page')
return
}