Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3355796
D10757.id36388.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
D10757.id36388.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
@@ -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
Details
Attached
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)
Attached To
Mode
D10757: [lib] refactor adding keyserver to ops
Attached
Detach File
Event Timeline
Log In to Comment