Include name in mention push notification (#2045)
This commit is contained in:
parent
3568fc1c62
commit
fca4d1ff92
@ -163,7 +163,8 @@ export async function nonCriticalSideEffects ({ invoice, id }, { models }) {
|
|||||||
where: invoice ? { invoiceId: invoice.id } : { id: parseInt(id) },
|
where: invoice ? { invoiceId: invoice.id } : { id: parseInt(id) },
|
||||||
include: {
|
include: {
|
||||||
mentions: true,
|
mentions: true,
|
||||||
itemReferrers: { include: { refereeItem: true } }
|
itemReferrers: { include: { refereeItem: true } },
|
||||||
|
user: true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// compare timestamps to only notify if mention or item referral was just created to avoid duplicates on edits
|
// compare timestamps to only notify if mention or item referral was just created to avoid duplicates on edits
|
||||||
|
@ -319,14 +319,14 @@ export const notifyZapped = async ({ models, item }) => {
|
|||||||
export const notifyMention = async ({ models, userId, item }) => {
|
export const notifyMention = async ({ models, userId, item }) => {
|
||||||
try {
|
try {
|
||||||
const muted = await isMuted({ models, muterId: userId, mutedId: item.userId })
|
const muted = await isMuted({ models, muterId: userId, mutedId: item.userId })
|
||||||
if (!muted) {
|
if (muted) return
|
||||||
await sendUserNotification(userId, {
|
|
||||||
title: 'you were mentioned',
|
await sendUserNotification(userId, {
|
||||||
body: item.text,
|
title: `@${item.user.name} mentioned you`,
|
||||||
item,
|
body: item.text,
|
||||||
tag: 'MENTION'
|
item,
|
||||||
})
|
tag: 'MENTION'
|
||||||
}
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user