Only send push notification if referrer was updated (#1562)
This commit is contained in:
parent
72e2d19433
commit
afb71012af
@ -77,8 +77,8 @@ function getCallbacks (req, res) {
|
|||||||
if (req.cookies.sn_referrer && user?.id) {
|
if (req.cookies.sn_referrer && user?.id) {
|
||||||
const referrerId = await getReferrerId(req.cookies.sn_referrer)
|
const referrerId = await getReferrerId(req.cookies.sn_referrer)
|
||||||
if (referrerId && referrerId !== parseInt(user?.id)) {
|
if (referrerId && referrerId !== parseInt(user?.id)) {
|
||||||
await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId } })
|
const { count } = await prisma.user.updateMany({ where: { id: user.id, referrerId: null }, data: { referrerId } })
|
||||||
notifyReferral(referrerId)
|
if (count > 0) notifyReferral(referrerId)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user