Page MenuHomePhabricator

D12352.diff
No OneTemporary

D12352.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
@@ -23,6 +23,7 @@
setUserSettingsActionTypes,
updateUserAvatarActionTypes,
} from '../actions/user-actions.js';
+import bots from '../facts/bots.js';
import { extractKeyserverIDFromID } from '../keyserver-conn/keyserver-call-utils.js';
import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js';
import {
@@ -224,6 +225,33 @@
.flat();
}
+function discardKeyserverUsernames(
+ newUserInfos: UserInfos,
+ stateUserInfos: UserInfos,
+): UserInfos {
+ let result: UserInfos = {};
+ for (const id in newUserInfos) {
+ if (id === bots.commbot.userID) {
+ result = {
+ ...result,
+ [id]: {
+ ...newUserInfos[id],
+ },
+ };
+ } else {
+ const username = stateUserInfos[id] ? stateUserInfos[id].username : null;
+ result = {
+ ...result,
+ [id]: {
+ ...newUserInfos[id],
+ username,
+ },
+ };
+ }
+ }
+ return result;
+}
+
type ReduceUserInfosResult = [
UserStore,
$ReadOnlyArray<ClientUserInconsistencyReportCreationRequest>,
@@ -314,10 +342,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
Tue, Dec 24, 9:42 PM (9 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2701057
Default Alt Text
D12352.diff (1 KB)

Event Timeline