Page MenuHomePhabricator

D11393.id38439.diff
No OneTemporary

D11393.id38439.diff

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
@@ -530,14 +530,25 @@
) => Promise<IdentityAuthResult> {
const client = React.useContext(IdentityClientContext);
const identityClient = client?.identityClient;
+ const preRequestUserState = useSelector(state => state.currentUserInfo);
+
return React.useCallback(
(username, password) => {
if (!identityClient) {
throw new Error('Identity service client is not initialized');
}
- return identityClient.logInPasswordUser(username, password);
+ return (async () => {
+ const result = await identityClient.logInPasswordUser(
+ username,
+ password,
+ );
+ return {
+ ...result,
+ preRequestUserState: preRequestUserState,
+ };
+ })();
},
- [identityClient],
+ [identityClient, preRequestUserState],
);
}
function useIdentityWalletLogIn(): (
diff --git a/lib/types/identity-service-types.js b/lib/types/identity-service-types.js
--- a/lib/types/identity-service-types.js
+++ b/lib/types/identity-service-types.js
@@ -13,6 +13,10 @@
type OlmSessionInitializationInfo,
olmSessionInitializationInfoValidator,
} from './request-types.js';
+import {
+ currentUserInfoValidator,
+ type CurrentUserInfo,
+} from './user-types.js';
import { tShape } from '../utils/validation-utils.js';
export type UserAuthMetadata = {
@@ -152,12 +156,14 @@
+userID: string,
+accessToken: string,
+username: string,
+ +preRequestUserState?: ?CurrentUserInfo,
};
export const identityAuthResultValidator: TInterface<IdentityAuthResult> =
tShape<IdentityAuthResult>({
userID: t.String,
accessToken: t.String,
username: t.String,
+ preRequestUserState: t.maybe(currentUserInfoValidator),
});
export type IdentityNewDeviceKeyUpload = {

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 3, 2:46 AM (21 h, 9 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2609853
Default Alt Text
D11393.id38439.diff (1 KB)

Event Timeline