Page MenuHomePhabricator

D10883.id36382.diff
No OneTemporary

D10883.id36382.diff

diff --git a/lib/reducers/keyserver-reducer.js b/lib/reducers/keyserver-reducer.js
--- a/lib/reducers/keyserver-reducer.js
+++ b/lib/reducers/keyserver-reducer.js
@@ -28,7 +28,7 @@
type KeyserverStoreOperation,
} from '../ops/keyserver-store-ops.js';
import { queueActivityUpdatesActionType } from '../types/activity-types.js';
-import type { KeyserverStore, KeyserverInfos } from '../types/keyserver-types';
+import type { KeyserverStore } from '../types/keyserver-types.js';
import type { BaseAction } from '../types/redux-types.js';
import {
fullStateSyncActionType,
@@ -421,36 +421,35 @@
keyserverInfos: processStoreOps(state.keyserverInfos, operations),
};
} else if (action.type === deleteKeyserverAccountActionTypes.success) {
- const keyserverIDsToRemove = new Set<string>(action.payload.keyserverIDs);
- const newKeyserverInfos: { ...KeyserverInfos } = {};
-
- const { keyserverInfos } = state;
-
- for (const keyserverID in keyserverInfos) {
- if (!keyserverIDsToRemove.has(keyserverID)) {
- newKeyserverInfos[keyserverID] = keyserverInfos[keyserverID];
- continue;
- }
- if (keyserverID === ashoatKeyserverID) {
- const oldConnection =
- state.keyserverInfos[ashoatKeyserverID].connection;
-
- newKeyserverInfos[ashoatKeyserverID] = {
- ...state.keyserverInfos[ashoatKeyserverID],
- connection: {
- ...oldConnection,
- connectionIssue: null,
- queuedActivityUpdates: [],
- lateResponses: [],
+ const operations: KeyserverStoreOperation[] = [
+ {
+ type: 'remove_keyservers',
+ payload: { ids: action.payload.keyserverIDs },
+ },
+ ];
+ if (action.payload.keyserverIDs.includes(ashoatKeyserverID)) {
+ const oldConnection = state.keyserverInfos[ashoatKeyserverID].connection;
+ operations.push({
+ type: 'replace_keyserver',
+ payload: {
+ id: ashoatKeyserverID,
+ keyserverInfo: {
+ ...state.keyserverInfos[ashoatKeyserverID],
+ connection: {
+ ...oldConnection,
+ connectionIssue: null,
+ queuedActivityUpdates: [],
+ lateResponses: [],
+ },
+ cookie: null,
},
- cookie: null,
- };
- }
+ },
+ });
}
return {
...state,
- keyserverInfos: newKeyserverInfos,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
};
} else if (action.type === setLateResponseActionType) {
const { messageID, isLate, keyserverID } = action.payload;

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 7:27 PM (8 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700894
Default Alt Text
D10883.id36382.diff (2 KB)

Event Timeline