Page MenuHomePhabricator

D12352.id41109.diff
No OneTemporary

D12352.id41109.diff

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
@@ -195,6 +195,33 @@
.flat();
}
+function discardKeyserverUsernames(
+ newUserInfos: UserInfos,
+ stateUserInfos: UserInfos,
+): UserInfos {
+ let result: UserInfos = {};
+ for (const id in newUserInfos) {
+ if (stateUserInfos[id]) {
+ result = {
+ ...result,
+ [id]: {
+ ...newUserInfos[id],
+ username: stateUserInfos[id].username,
+ },
+ };
+ } else {
+ result = {
+ ...result,
+ [id]: {
+ ...newUserInfos[id],
+ username: null,
+ },
+ };
+ }
+ }
+ return result;
+}
+
function reduceUserInfos(
state: UserStore,
action: BaseAction,
@@ -248,10 +275,15 @@
if (keyserverID !== authoritativeKeyserverID()) {
return [state, [], []];
}
- const newUserInfos: UserInfos = _keyBy(userInfo => userInfo.id)(
+ const keyserverUserInfos: UserInfos = _keyBy(userInfo => userInfo.id)(
action.payload.userInfos,
);
+ const newUserInfos = discardKeyserverUsernames(
+ keyserverUserInfos,
+ state.userInfos,
+ );
+
const userStoreOps: $ReadOnlyArray<UserStoreOperation> =
convertUserInfosToReplaceUserOps(newUserInfos);
const processedUserInfos: UserInfos = processUserStoreOps(

File Metadata

Mime Type
text/plain
Expires
Wed, Dec 25, 11:52 AM (10 h, 41 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2702616
Default Alt Text
D12352.id41109.diff (1 KB)

Event Timeline