diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js --- a/keyserver/src/creators/message-creator.js +++ b/keyserver/src/creators/message-creator.js @@ -456,21 +456,28 @@ fetchMessageInfoByID(viewer, messageID), }, ); - return doesGenerateNotif === pushType ? messageInfo : undefined; + return doesGenerateNotif === pushType + ? { messageInfo, messageData } + : undefined; }), ); } - const notifMessageInfos = await Promise.all(promises); - const filteredNotifMessageInfos = notifMessageInfos.filter(Boolean); + const messagesToNotify = await Promise.all(promises); + const filteredMessagesToNotify = messagesToNotify.filter(Boolean); - if (filteredNotifMessageInfos.length === 0) { + if (filteredMessagesToNotify.length === 0) { return undefined; } return { devices: userDevices, - messageInfos: filteredNotifMessageInfos, + messageInfos: filteredMessagesToNotify.map( + ({ messageInfo }) => messageInfo, + ), + messageDatas: filteredMessagesToNotify.map( + ({ messageData }) => messageData, + ), }; }; diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js --- a/keyserver/src/push/send.js +++ b/keyserver/src/push/send.js @@ -26,6 +26,7 @@ import { type RawMessageInfo, type MessageInfo, + type MessageData, messageTypes, } from 'lib/types/message-types.js'; import type { WebNotification } from 'lib/types/notif-types.js'; @@ -62,7 +63,9 @@ }; type PushUserInfo = { +devices: Device[], + // messageInfos and messageDatas have the same key +messageInfos: RawMessageInfo[], + +messageDatas: MessageData[], }; type Delivery = PushDelivery | { collapsedInto: string }; type NotificationRow = {