Fix TypeError during push notifications (#448)

Without this, following error is thrown when notifying users about new replies:

[webPush] error sending user notification:  TypeError: Cannot read properties of undefined (reading 'id')
app  |     at createItemUrl (webpack-internal:///(api)/./api/webPush/index.js:76:29)
app  |     at async sendUserNotification (webpack-internal:///(api)/./api/webPush/index.js:125:33)
app  |     at async Promise.allSettled (index 0)

Co-authored-by: ekzyis <ek@stacker.news>
This commit is contained in:
ekzyis 2023-08-28 14:16:34 +02:00 committed by GitHub
parent ded3bd680f
commit 4a0e615d7d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 1 deletions

View File

@ -684,7 +684,7 @@ export default {
parents.map(({ userId }) => sendUserNotification(userId, { parents.map(({ userId }) => sendUserNotification(userId, {
title: `@${user.name} replied to you`, title: `@${user.name} replied to you`,
body: item.text, body: item.text,
item, item: rItem,
tag: 'REPLY' tag: 'REPLY'
})) }))
) )