Page MenuHomePhabricator

D6085.id20295.diff
No OneTemporary

D6085.id20295.diff

diff --git a/lib/actions/siwe-actions.js b/lib/actions/siwe-actions.js
--- a/lib/actions/siwe-actions.js
+++ b/lib/actions/siwe-actions.js
@@ -1,10 +1,12 @@
// @flow
import threadWatcher from '../shared/thread-watcher.js';
-import type { LogInResponse } from '../types/account-types.js';
+import type { LogInResult } from '../types/account-types.js';
+import { logInActionSources } from '../types/account-types.js';
import type { SIWEAuthServerCall } from '../types/siwe-types.js';
import type { CallServerEndpoint } from '../utils/call-server-endpoint';
import { getConfig } from '../utils/config.js';
+import { mergeUserInfos } from './user-actions.js';
const getSIWENonceActionTypes = Object.freeze({
started: 'GET_SIWE_NONCE_STARTED',
@@ -28,7 +30,7 @@
callServerEndpoint: CallServerEndpoint,
): ((
siweAuthPayload: SIWEAuthServerCall,
-) => Promise<LogInResponse>) => async siweAuthPayload => {
+) => Promise<LogInResult>) => async siweAuthPayload => {
const watchedIDs = threadWatcher.getWatchedIDs();
const response = await callServerEndpoint(
'siwe_auth',
@@ -39,7 +41,27 @@
},
siweAuthCallServerEndpointOptions,
);
- return response;
+ const userInfos = mergeUserInfos(
+ response.userInfos,
+ response.cookieChange.userInfos,
+ );
+ return {
+ threadInfos: response.cookieChange.threadInfos,
+ currentUserInfo: response.currentUserInfo,
+ calendarResult: {
+ calendarQuery: siweAuthPayload.calendarQuery,
+ rawEntryInfos: response.rawEntryInfos,
+ },
+ messagesResult: {
+ messageInfos: response.rawMessageInfos,
+ truncationStatus: response.truncationStatuses,
+ watchedIDsAtRequestTime: watchedIDs,
+ currentAsOf: response.serverTime,
+ },
+ userInfos,
+ updatesCurrentAsOf: response.serverTime,
+ logInActionSource: logInActionSources.logInFromNativeSIWE,
+ };
};
export { getSIWENonceActionTypes, getSIWENonce, siweAuthActionTypes, siweAuth };
diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -242,6 +242,7 @@
deleteAccount,
deleteAccountActionTypes,
getSessionPublicKeys,
+ mergeUserInfos,
logIn,
logInActionTypes,
logOut,
diff --git a/lib/types/account-types.js b/lib/types/account-types.js
--- a/lib/types/account-types.js
+++ b/lib/types/account-types.js
@@ -86,6 +86,7 @@
sqliteLoadFailure: 'SQLITE_LOAD_FAILURE',
logInFromWebForm: 'LOG_IN_FROM_WEB_FORM',
logInFromNativeForm: 'LOG_IN_FROM_NATIVE_FORM',
+ logInFromNativeSIWE: 'LOG_IN_FROM_NATIVE_SIWE',
});
export type LogInActionSource = $Values<typeof logInActionSources>;
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -7,7 +7,6 @@
LogInResult,
RegisterResult,
DefaultNotificationPayload,
- LogInResponse,
} from './account-types';
import type {
ActivityUpdateSuccessPayload,
@@ -902,7 +901,7 @@
}
| {
+type: 'SIWE_AUTH_SUCCESS',
- +payload: LogInResponse,
+ +payload: LogInResult,
+loadingInfo: LoadingInfo,
}
| {

File Metadata

Mime Type
text/plain
Expires
Mon, Oct 7, 1:13 AM (21 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251783
Default Alt Text
D6085.id20295.diff (3 KB)

Event Timeline