diff --git a/keyserver/src/responders/user-responders.js b/keyserver/src/responders/user-responders.js --- a/keyserver/src/responders/user-responders.js +++ b/keyserver/src/responders/user-responders.js @@ -43,7 +43,11 @@ IdentityKeysBlob, SignedIdentityKeysBlob, } from 'lib/types/crypto-types.js'; -import type { DeviceType } from 'lib/types/device-types'; +import type { + DeviceType, + DeviceTokenUpdateRequest, + PlatformDetails, +} from 'lib/types/device-types'; import { type CalendarQuery, rawEntryInfoValidator, @@ -295,7 +299,9 @@ type ProcessSuccessfulLoginParams = { +viewer: Viewer, - +input: any, + +deviceTokenUpdateRequest?: ?DeviceTokenUpdateRequest, + +platformDetails: PlatformDetails, + +watchedIDs: $ReadOnlyArray, +userID: string, +calendarQuery: ?CalendarQuery, +socialProof?: ?SIWESocialProof, @@ -310,7 +316,9 @@ ): Promise { const { viewer, - input, + deviceTokenUpdateRequest, + platformDetails, + watchedIDs, userID, calendarQuery, socialProof, @@ -320,10 +328,9 @@ cookieHasBeenSet, } = params; - const request: LogInRequest = input; const newServerTime = Date.now(); - const deviceToken = request.deviceTokenUpdateRequest - ? request.deviceTokenUpdateRequest.deviceToken + const deviceToken = deviceTokenUpdateRequest + ? deviceTokenUpdateRequest.deviceToken : viewer.deviceToken; const setNewCookiePromise = (async () => { if (cookieHasBeenSet) { @@ -331,7 +338,7 @@ } const [userViewerData] = await Promise.all([ createNewUserCookie(userID, { - platformDetails: request.platformDetails, + platformDetails: platformDetails, deviceToken, socialProof, signedIdentityKeysBlob, @@ -395,7 +402,7 @@ })(); const threadCursors: { [string]: null } = {}; - for (const watchedThreadID of request.watchedIDs) { + for (const watchedThreadID of watchedIDs) { threadCursors[watchedThreadID] = null; } const messageSelectionCriteria = { threadCursors, joinedThreads: true }; @@ -544,7 +551,9 @@ return await processSuccessfulLogin({ viewer, - input: request, + platformDetails: request.platformDetails, + deviceTokenUpdateRequest: request.deviceTokenUpdateRequest, + watchedIDs: request.watchedIDs, userID: id, calendarQuery, signedIdentityKeysBlob, @@ -687,7 +696,9 @@ // 10. Complete login with call to `processSuccessfulLogin(...)`. return await processSuccessfulLogin({ viewer, - input: request, + platformDetails: request.platformDetails, + deviceTokenUpdateRequest: request.deviceTokenUpdateRequest, + watchedIDs: request.watchedIDs, userID, calendarQuery, socialProof, @@ -809,7 +820,9 @@ // 5. Complete login with call to `processSuccessfulLogin(...)`. return await processSuccessfulLogin({ viewer, - input: request, + platformDetails: request.platformDetails, + deviceTokenUpdateRequest: request.deviceTokenUpdateRequest, + watchedIDs: request.watchedIDs, userID, calendarQuery, signedIdentityKeysBlob,