Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3526065
D10883.id36381.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
D10883.id36381.diff
View Options
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 (state.keyserverInfos[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
Details
Attached
Mime Type
text/plain
Expires
Tue, Dec 24, 7:27 PM (8 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700893
Default Alt Text
D10883.id36381.diff (2 KB)
Attached To
Mode
D10883: [lib] refactor deleting keyserver account `keyserver-reducer` to ops
Attached
Detach File
Event Timeline
Log In to Comment