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 @@ -747,6 +747,34 @@ ); } + const canQueryBlobService = + platformDetails.codeVersion && + platformDetails.codeVersion >= FUTURE_CODE_VERSION; + + let blobHash, encryptionKey, blobUploadError; + if (canQueryBlobService) { + ({ + blobHash: blobHash, + encryptionKey: encryptionKey, + blobUploadError: blobUploadError, + } = await blobServiceUpload(copyWithMessageInfos.compile())); + } + + if (blobUploadError) { + console.warn( + `Failed to upload payload of notification: ${uniqueID} ` + + `due to error: ${blobUploadError}`, + ); + } + + if (blobHash && encryptionKey) { + notification.payload = { + blobHash, + encryptionKey, + ...notification.payload, + }; + } + const notifsWithoutMessageInfos = await prepareEncryptedIOSNotifications( devicesWithSizeViolation, notification,