Page MenuHomePhabricator

D9751.diff
No OneTemporary

D9751.diff

diff --git a/keyserver/src/session/viewer.js b/keyserver/src/session/viewer.js
--- a/keyserver/src/session/viewer.js
+++ b/keyserver/src/session/viewer.js
@@ -147,7 +147,7 @@
}
}
- setDeviceToken(deviceToken: string) {
+ setDeviceToken(deviceToken: ?string) {
if (this.data.loggedIn) {
this.data = { ...this.data, deviceToken };
} else {
diff --git a/keyserver/src/updaters/device-token-updaters.js b/keyserver/src/updaters/device-token-updaters.js
--- a/keyserver/src/updaters/device-token-updaters.js
+++ b/keyserver/src/updaters/device-token-updaters.js
@@ -14,12 +14,15 @@
if (deviceType === undefined) {
throw new ServerError('invalid_parameters');
}
+ const { deviceToken } = update;
- viewer.setDeviceToken(update.deviceToken);
- await clearDeviceToken(update.deviceToken);
+ viewer.setDeviceToken(deviceToken);
+ if (deviceToken) {
+ await clearDeviceToken(deviceToken);
+ }
const setColumns = {};
- setColumns.device_token = update.deviceToken;
+ setColumns.device_token = deviceToken;
setColumns.platform = deviceType;
if (update.platformDetails) {
const { platform, ...versions } = update.platformDetails;
diff --git a/lib/types/device-types.js b/lib/types/device-types.js
--- a/lib/types/device-types.js
+++ b/lib/types/device-types.js
@@ -30,7 +30,7 @@
}
export type DeviceTokenUpdateRequest = {
- +deviceToken: string,
+ +deviceToken: ?string,
+deviceType?: DeviceType,
+platformDetails?: PlatformDetails,
};

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 9:05 PM (11 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2703172
Default Alt Text
D9751.diff (1 KB)

Event Timeline