Include name in mention push notification (#2045)

This commit is contained in:
ekzyis 2025-03-31 11:59:57 -05:00 committed by GitHub
parent 3568fc1c62
commit fca4d1ff92
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 10 additions and 9 deletions

View File

@ -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

View File

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