mirror of
https://github.com/versia-pub/server.git
synced 2025-12-06 08:28:19 +01:00
fix(api): 🐛 Properly await notification result
This commit is contained in:
parent
cde2836982
commit
bedc25bacf
|
|
@ -18,6 +18,10 @@ export const getPushWorker = (): Worker<PushJobData, void, PushJobType> =>
|
||||||
data: { psId, relatedUserId, type, noteId, notificationId },
|
data: { psId, relatedUserId, type, noteId, notificationId },
|
||||||
} = job;
|
} = job;
|
||||||
|
|
||||||
|
await job.log(
|
||||||
|
`Sending push notification for note [${notificationId}]`,
|
||||||
|
);
|
||||||
|
|
||||||
const ps = await PushSubscription.fromId(psId);
|
const ps = await PushSubscription.fromId(psId);
|
||||||
|
|
||||||
if (!ps) {
|
if (!ps) {
|
||||||
|
|
@ -87,7 +91,7 @@ export const getPushWorker = (): Worker<PushJobData, void, PushJobType> =>
|
||||||
? htmlToText(note.data.spoilerText || note.data.content)
|
? htmlToText(note.data.spoilerText || note.data.content)
|
||||||
: htmlToText(relatedUser.data.note);
|
: htmlToText(relatedUser.data.note);
|
||||||
|
|
||||||
sendNotification(
|
await sendNotification(
|
||||||
{
|
{
|
||||||
endpoint: ps.data.endpoint,
|
endpoint: ps.data.endpoint,
|
||||||
keys: {
|
keys: {
|
||||||
|
|
@ -115,6 +119,10 @@ export const getPushWorker = (): Worker<PushJobData, void, PushJobType> =>
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
await job.log(
|
||||||
|
`✔ Finished delivering push notification for note [${notificationId}]`,
|
||||||
|
);
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
connection,
|
connection,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue