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
Sat, Nov 9, 1:57 AM (17 h, 53 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2447378
Default Alt Text
D9751.diff (1 KB)

Event Timeline