Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3526329
D12352.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D12352.diff
View Options
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
Details
Attached
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)
Attached To
Mode
D12352: [lib] Discard keyserver usernames for joinThreadActionTypes and newThreadActionTypes
Attached
Detach File
Event Timeline
Log In to Comment