Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3395008
D9149.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D9149.diff
View Options
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
@@ -23,6 +23,7 @@
rawThreadInfoFromServerThreadInfo,
threadInfoFromRawThreadInfo,
} from 'lib/shared/thread-utils.js';
+import { NEXT_CODE_VERSION } from 'lib/shared/version-utils.js';
import type { Platform, PlatformDetails } from 'lib/types/device-types.js';
import { messageTypes } from 'lib/types/message-types-enum.js';
import {
@@ -770,16 +771,22 @@
platformDetails,
} = convertedData;
- const isTextNotification = newRawMessageInfos.every(
- newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
- );
+ const canDecryptNonCollapsibleTextNotifs =
+ platformDetails.codeVersion && platformDetails.codeVersion > 222;
+
+ const isNonCollapsibleTextNotification =
+ newRawMessageInfos.every(
+ newRawMessageInfo => newRawMessageInfo.type === messageTypes.TEXT,
+ ) && !collapseKey;
+
+ const canDecryptAllNotifTypes =
+ platformDetails.codeVersion &&
+ platformDetails.codeVersion >= NEXT_CODE_VERSION;
const shouldBeEncrypted =
platformDetails.platform === 'ios' &&
- !collapseKey &&
- isTextNotification &&
- platformDetails.codeVersion &&
- platformDetails.codeVersion > 222;
+ (canDecryptAllNotifTypes ||
+ (isNonCollapsibleTextNotification && canDecryptNonCollapsibleTextNotifs));
const uniqueID = uuidv4();
const notification = new apn.Notification();
@@ -808,7 +815,9 @@
if (platformDetails.codeVersion && platformDetails.codeVersion > 198) {
notification.mutableContent = true;
}
- if (collapseKey) {
+ if (collapseKey && canDecryptAllNotifTypes) {
+ notification.payload.collapseID = collapseKey;
+ } else if (collapseKey) {
notification.collapseId = collapseKey;
}
const messageInfos = JSON.stringify(newRawMessageInfos);
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Dec 2, 12:55 AM (1 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2606375
Default Alt Text
D9149.diff (1 KB)
Attached To
Mode
D9149: Encrypt all notifications on the keyserver for iOS devices
Attached
Detach File
Event Timeline
Log In to Comment