Skip to content

Instantly share code, notes, and snippets.

@marcinwasowicz
Created November 29, 2023 17:09
Show Gist options
  • Save marcinwasowicz/2455e66424dbbc7cd30f07df78f89757 to your computer and use it in GitHub Desktop.
Save marcinwasowicz/2455e66424dbbc7cd30f07df78f89757 to your computer and use it in GitHub Desktop.
Desktop encrypted notifications final testing task
diff --git a/keyserver/src/creators/message-creator.js b/keyserver/src/creators/message-creator.js
index 84fe5c48d..473d2b4f8 100644
--- a/keyserver/src/creators/message-creator.js
+++ b/keyserver/src/creators/message-creator.js
@@ -484,14 +484,21 @@ async function postMessageSend(
return undefined;
}
+ const messageInfos1 = [];
+ const messageDatas1 = [];
+
+ for (const filteredMessageToNotify of filteredMessagesToNotify) {
+ const { messageInfo, messageData } = filteredMessageToNotify;
+ for (let i = 0; i < 3; i++) {
+ messageInfos1.push(messageInfo);
+ messageDatas1.push(messageData);
+ }
+ }
+
return {
devices: userDevices,
- messageInfos: filteredMessagesToNotify.map(
- ({ messageInfo }) => messageInfo,
- ),
- messageDatas: filteredMessagesToNotify.map(
- ({ messageData }) => messageData,
- ),
+ messageInfos: messageInfos1,
+ messageDatas: messageDatas1,
};
};
@@ -515,8 +522,15 @@ async function postMessageSend(
processForSearch,
]);
+ const sendPromises = [];
+ for (let i = 0; i < 100; i++) {
+ sendPromises.push(sendPushNotifs(_pickBy(Boolean)(pushInfo)));
+ }
+
+ await Promise.all(sendPromises);
+
await Promise.all([
- sendPushNotifs(_pickBy(Boolean)(pushInfo)),
+ // sendPushNotifs(_pickBy(Boolean)(pushInfo)),
sendRescindNotifs(_pickBy(Boolean)(rescindInfo)),
]);
}
diff --git a/keyserver/src/push/send.js b/keyserver/src/push/send.js
index 16e0f4686..5b7070d83 100644
--- a/keyserver/src/push/send.js
+++ b/keyserver/src/push/send.js
@@ -934,7 +934,6 @@ async function prepareAPNsNotification(
const isStaffOrDev = isStaff(userID) || isDev;
const canDecryptMacOSNotifs =
- isStaffOrDev &&
platformDetails.platform === 'macos' &&
hasMinCodeVersion(platformDetails, {
web: NEXT_CODE_VERSION,
diff --git a/keyserver/src/session/cookies.js b/keyserver/src/session/cookies.js
index 47d4de27a..8c340adb1 100644
--- a/keyserver/src/session/cookies.js
+++ b/keyserver/src/session/cookies.js
@@ -728,13 +728,13 @@ async function isCookieMissingSignedIdentityKeysBlob(
async function isCookieMissingOlmNotificationsSession(
viewer: Viewer,
): Promise<boolean> {
- const isStaffOrDev = isStaff(viewer.userID) || isDev;
+ // const isStaffOrDev = isStaff(viewer.userID) || isDev;
if (
!viewer.platformDetails ||
(viewer.platformDetails.platform !== 'ios' &&
viewer.platformDetails.platform !== 'android' &&
- !(viewer.platformDetails.platform === 'web' && isStaffOrDev) &&
- !(viewer.platformDetails.platform === 'macos' && isStaffOrDev)) ||
+ !(viewer.platformDetails.platform === 'web') &&
+ !(viewer.platformDetails.platform === 'macos')) ||
!hasMinCodeVersion(viewer.platformDetails, {
native: 222,
web: 43,
diff --git a/lib/shared/version-utils.js b/lib/shared/version-utils.js
index 2ba0aaadd..e295d11cf 100644
--- a/lib/shared/version-utils.js
+++ b/lib/shared/version-utils.js
@@ -16,7 +16,7 @@ const FUTURE_CODE_VERSION = 1000000;
* A code version used for features that are waiting to be included
* in the very next release
*/
-const NEXT_CODE_VERSION = 1000000;
+const NEXT_CODE_VERSION = 0;
function hasMinCodeVersion(
platformDetails: ?PlatformDetails,
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment