Page MenuHomePhabricator

D12216.id.diff
No OneTemporary

D12216.id.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
@@ -1004,6 +1004,8 @@
return { updates };
};
+const processNewUserIDsActionType = 'PROCESS_NEW_USER_IDS';
+
export {
changeKeyserverUserPasswordActionTypes,
changeKeyserverUserPassword,
@@ -1049,4 +1051,5 @@
useIdentityWalletRegister,
identityGenerateNonceActionTypes,
useIdentityGenerateNonce,
+ processNewUserIDsActionType,
};
diff --git a/lib/reducers/user-reducer.js b/lib/reducers/user-reducer.js
--- a/lib/reducers/user-reducer.js
+++ b/lib/reducers/user-reducer.js
@@ -10,6 +10,7 @@
newThreadActionTypes,
} from '../actions/thread-actions.js';
import {
+ processNewUserIDsActionType,
identityLogInActionTypes,
identityRegisterActionTypes,
deleteAccountActionTypes,
@@ -200,7 +201,34 @@
$ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>,
$ReadOnlyArray<UserStoreOperation>,
] {
- if (
+ if (action.type === processNewUserIDsActionType) {
+ const filteredUserIDs = action.payload.userIDs.filter(
+ id => !state.userInfos[id],
+ );
+ const newUserInfosArray = filteredUserIDs.map(id => ({
+ id,
+ username: null,
+ }));
+ const newUserInfos: UserInfos = _keyBy(userInfo => userInfo.id)(
+ newUserInfosArray,
+ );
+
+ const userStoreOps: $ReadOnlyArray<UserStoreOperation> =
+ convertUserInfosToReplaceUserOps(newUserInfos);
+ const processedUserInfos: UserInfos = processUserStoreOps(
+ state.userInfos,
+ userStoreOps,
+ );
+
+ return [
+ {
+ ...state,
+ userInfos: processedUserInfos,
+ },
+ [],
+ userStoreOps,
+ ];
+ } else if (
action.type === joinThreadActionTypes.success ||
action.type === newThreadActionTypes.success
) {
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
@@ -1441,6 +1441,13 @@
+error: true,
+payload: Error,
+loadingInfo: LoadingInfo,
+ }
+ | {
+ +type: 'PROCESS_NEW_USER_IDS',
+ +payload: {
+ +userIDs: $ReadOnlyArray<string>,
+ },
+ +loadingInfo: LoadingInfo,
},
}>;

File Metadata

Mime Type
text/plain
Expires
Tue, Nov 19, 3:25 AM (17 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2536608
Default Alt Text
D12216.id.diff (2 KB)

Event Timeline