Page MenuHomePhabricator

D10757.id35912.diff
No OneTemporary

D10757.id35912.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
@@ -20,6 +20,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';
@@ -37,20 +41,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
Thu, Nov 28, 9:55 AM (21 h, 1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2593719
Default Alt Text
D10757.id35912.diff (1 KB)

Event Timeline