Page MenuHomePhabricator

D10966.id36691.diff
No OneTemporary

D10966.id36691.diff

diff --git a/lib/ops/keyserver-store-ops.js b/lib/ops/keyserver-store-ops.js
--- a/lib/ops/keyserver-store-ops.js
+++ b/lib/ops/keyserver-store-ops.js
@@ -8,6 +8,7 @@
import type {
KeyserverInfo,
KeyserverInfos,
+ KeyserverStore,
} from '../types/keyserver-types.js';
// client types
@@ -69,21 +70,21 @@
}
const keyserverStoreOpsHandlers: BaseStoreOpsHandlers<
- KeyserverInfos,
+ KeyserverStore,
KeyserverStoreOperation,
ClientDBKeyserverStoreOperation,
KeyserverInfos,
ClientDBKeyserverInfo,
> = {
processStoreOperations(
- keyserverInfos: KeyserverInfos,
+ keyserverStore: KeyserverStore,
ops: $ReadOnlyArray<KeyserverStoreOperation>,
- ): KeyserverInfos {
+ ): KeyserverStore {
if (ops.length === 0) {
- return keyserverInfos;
+ return keyserverStore;
}
- let processedKeyserverInfos = { ...keyserverInfos };
+ let processedKeyserverInfos = { ...keyserverStore.keyserverInfos };
for (const operation: KeyserverStoreOperation of ops) {
if (operation.type === 'replace_keyserver') {
processedKeyserverInfos[operation.payload.id] =
@@ -96,7 +97,7 @@
processedKeyserverInfos = {};
}
}
- return processedKeyserverInfos;
+ return { ...keyserverStore, keyserverInfos: processedKeyserverInfos };
},
convertOpsToClientDBOps(
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
@@ -65,12 +65,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [
- replaceOperation,
- ]),
- },
+ keyserverStore: processStoreOps(state, [replaceOperation]),
keyserverStoreOperations: [replaceOperation],
};
} else if (action.type === removeKeyserverActionType) {
@@ -82,12 +77,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [
- removeOperation,
- ]),
- },
+ keyserverStore: processStoreOps(state, [removeOperation]),
keyserverStoreOperations: [removeOperation],
};
} else if (action.type === resetUserStateActionType) {
@@ -111,13 +101,7 @@
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(
- state.keyserverInfos,
- replaceOperations,
- ),
- },
+ keyserverStore: processStoreOps(state, replaceOperations),
keyserverStoreOperations: replaceOperations,
};
} else if (action.type === setNewSessionActionType) {
@@ -170,10 +154,7 @@
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (
@@ -202,10 +183,7 @@
});
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (action.type === fullStateSyncActionType) {
@@ -222,10 +200,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === incrementalStateSyncActionType) {
@@ -253,10 +228,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === processUpdatesActionType) {
@@ -276,10 +248,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === setURLPrefix) {
@@ -294,10 +263,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === updateLastCommunicatedPlatformDetailsActionType) {
@@ -313,10 +279,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === keyserverRegisterActionTypes.success) {
@@ -331,10 +294,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === updateConnectionStatusActionType) {
@@ -354,10 +314,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === unsupervisedBackgroundActionType) {
@@ -377,10 +334,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === queueActivityUpdatesActionType) {
@@ -418,10 +372,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === updateActivityActionTypes.success) {
@@ -447,10 +398,7 @@
});
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (
@@ -480,10 +428,7 @@
});
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (action.type === deleteKeyserverAccountActionTypes.success) {
@@ -514,10 +459,7 @@
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (action.type === setLateResponseActionType) {
@@ -545,10 +487,7 @@
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === updateKeyserverReachabilityActionType) {
@@ -567,10 +506,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
} else if (action.type === setDeviceTokenActionTypes.success) {
@@ -589,10 +525,7 @@
});
}
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
- },
+ keyserverStore: processStoreOps(state, operations),
keyserverStoreOperations: operations,
};
} else if (action.type === setConnectionIssueActionType) {
@@ -611,10 +544,7 @@
},
};
return {
- keyserverStore: {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
- },
+ keyserverStore: processStoreOps(state, [operation]),
keyserverStoreOperations: [operation],
};
}
diff --git a/lib/reducers/master-reducer.js b/lib/reducers/master-reducer.js
--- a/lib/reducers/master-reducer.js
+++ b/lib/reducers/master-reducer.js
@@ -131,13 +131,10 @@
}
}
if (replaceOperations.length > 0) {
- keyserverStore = {
- ...keyserverStore,
- keyserverInfos: keyserverStoreOpsHandlers.processStoreOperations(
- keyserverStore.keyserverInfos,
- replaceOperations,
- ),
- };
+ keyserverStore = keyserverStoreOpsHandlers.processStoreOperations(
+ keyserverStore,
+ replaceOperations,
+ );
}
}
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -164,13 +164,10 @@
...state,
...rest,
userStore: { userInfos },
- keyserverStore: {
- ...state.keyserverStore,
- keyserverInfos: keyserverStoreOpsHandlers.processStoreOperations(
- state.keyserverStore.keyserverInfos,
- replaceOperations,
- ),
- },
+ keyserverStore: keyserverStoreOpsHandlers.processStoreOperations(
+ state.keyserverStore,
+ replaceOperations,
+ ),
initialStateLoaded: true,
},
storeOperations,
@@ -231,13 +228,10 @@
};
state = {
...state,
- keyserverStore: {
- ...state.keyserverStore,
- keyserverInfos: keyserverStoreOpsHandlers.processStoreOperations(
- state.keyserverStore.keyserverInfos,
- [replaceOperation],
- ),
- },
+ keyserverStore: keyserverStoreOpsHandlers.processStoreOperations(
+ state.keyserverStore,
+ [replaceOperation],
+ ),
};
} else if (
action.type === deleteKeyserverAccountActionTypes.success &&

File Metadata

Mime Type
text/plain
Expires
Sat, Dec 28, 3:03 AM (6 h, 31 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2723589
Default Alt Text
D10966.id36691.diff (10 KB)

Event Timeline