Page MenuHomePhabricator

D10757.id36388.diff
No OneTemporary

D10757.id36388.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
@@ -21,6 +21,10 @@
resetUserStateActionType,
} from '../actions/user-actions.js';
import { setNewSessionActionType } from '../keyserver-conn/keyserver-conn-types.js';
+import {
+ keyserverStoreOpsHandlers,
+ type ReplaceKeyserverOperation,
+} from '../ops/keyserver-store-ops.js';
import { queueActivityUpdatesActionType } from '../types/activity-types.js';
import type { KeyserverInfos, KeyserverStore } from '../types/keyserver-types';
import type { BaseAction } from '../types/redux-types.js';
@@ -38,20 +42,27 @@
import { setURLPrefix } from '../utils/url-utils.js';
import { ashoatKeyserverID } from '../utils/validation-utils.js';
+const { processStoreOperations: processStoreOps } = keyserverStoreOpsHandlers;
+
export default function reduceKeyserverStore(
state: KeyserverStore,
action: BaseAction,
): KeyserverStore {
if (action.type === addKeyserverActionType) {
- return {
- ...state,
- keyserverInfos: {
- ...state.keyserverInfos,
- [action.payload.keyserverAdminUserID]: {
+ const replaceOperation: ReplaceKeyserverOperation = {
+ type: 'replace_keyserver',
+ payload: {
+ id: action.payload.keyserverAdminUserID,
+ keyserverInfo: {
...action.payload.newKeyserverInfo,
},
},
};
+
+ return {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [replaceOperation]),
+ };
} else if (action.type === removeKeyserverActionType) {
const { [action.payload.keyserverAdminUserID]: _, ...rest } =
state.keyserverInfos;

File Metadata

Mime Type
text/plain
Expires
Sun, Nov 24, 3:33 PM (20 h, 52 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2576129
Default Alt Text
D10757.id36388.diff (1 KB)

Event Timeline