Page MenuHomePhabricator

D9199.diff
No OneTemporary

D9199.diff

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
@@ -922,15 +922,20 @@
platformDetails: { codeVersion },
dbID,
} = convertedData;
+ const canDecryptNonCollapsibleTextNotifs = codeVersion && codeVersion > 228;
- const isTextNotification = newRawMessageInfos.every(
- newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
- );
+ const isNonCollapsibleTextNotif =
+ newRawMessageInfos.every(
+ newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
+ ) && !collapseKey;
+
+ const canDecryptAllNotifTypes =
+ codeVersion && codeVersion >= NEXT_CODE_VERSION;
const shouldBeEncrypted =
- isTextNotification && !collapseKey && codeVersion && codeVersion > 228;
+ canDecryptAllNotifTypes ||
+ (canDecryptNonCollapsibleTextNotifs && isNonCollapsibleTextNotif);
- const notifID = collapseKey ? collapseKey : dbID;
const { merged, ...rest } = notifTexts;
const notification = {
data: {
@@ -940,6 +945,19 @@
},
};
+ let notifID;
+ if (collapseKey && canDecryptAllNotifTypes) {
+ notifID = dbID;
+ notification.data = {
+ ...notification.data,
+ collapseKey,
+ };
+ } else if (collapseKey) {
+ notifID = collapseKey;
+ } else {
+ notifID = dbID;
+ }
+
// The reason we only include `badgeOnly` for newer clients is because older
// clients don't know how to parse it. The reason we only include `id` for
// newer clients is that if the older clients see that field, they assume
diff --git a/keyserver/src/push/types.js b/keyserver/src/push/types.js
--- a/keyserver/src/push/types.js
+++ b/keyserver/src/push/types.js
@@ -14,6 +14,7 @@
+title?: string,
+prefix?: string,
+threadID?: string,
+ +collapseKey?: string,
+encryptionFailed?: '1',
};

File Metadata

Mime Type
text/plain
Expires
Fri, Jan 10, 2:42 PM (16 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2844772
Default Alt Text
D9199.diff (1 KB)

Event Timeline