Page MenuHomePhabricator

D10773.id35949.diff
No OneTemporary

D10773.id35949.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
@@ -48,7 +48,10 @@
export default function reduceKeyserverStore(
state: KeyserverStore,
action: BaseAction,
-): KeyserverStore {
+): {
+ keyserverStore: KeyserverStore,
+ keyserverStoreOperations: $ReadOnlyArray<KeyserverStoreOperation>,
+} {
if (action.type === addKeyserverActionType) {
const replaceOperation: ReplaceKeyserverOperation = {
type: 'replace_keyserver',
@@ -61,8 +64,13 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [replaceOperation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [
+ replaceOperation,
+ ]),
+ },
+ keyserverStoreOperations: [replaceOperation],
};
} else if (action.type === removeKeyserverActionType) {
const removeOperation: RemoveKeyserverOperation = {
@@ -73,8 +81,13 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [removeOperation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [
+ removeOperation,
+ ]),
+ },
+ keyserverStoreOperations: [removeOperation],
};
} else if (action.type === resetUserStateActionType) {
// this action is only dispatched on native
@@ -98,8 +111,14 @@
}
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, replaceOperations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(
+ state.keyserverInfos,
+ replaceOperations,
+ ),
+ },
+ keyserverStoreOperations: replaceOperations,
};
} else if (action.type === setNewSessionActionType) {
const { keyserverID, sessionChange } = action.payload;
@@ -110,7 +129,10 @@
`but keyserver ${keyserverID} is not in KeyserverStore!`,
);
}
- return state;
+ return {
+ keyserverStore: state,
+ keyserverStoreOperations: [],
+ };
}
const operations: ReplaceKeyserverOperation[] = [];
if (sessionChange.cookie !== undefined) {
@@ -141,8 +163,11 @@
});
}
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ },
+ keyserverStoreOperations: operations,
};
} else if (
action.type === logInActionTypes.success ||
@@ -166,8 +191,11 @@
});
}
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ },
+ keyserverStoreOperations: operations,
};
} else if (action.type === fullStateSyncActionType) {
const { keyserverID } = action.payload;
@@ -183,8 +211,11 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === incrementalStateSyncActionType) {
const { keyserverID } = action.payload;
@@ -211,8 +242,11 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === processUpdatesActionType) {
const { keyserverID } = action.payload;
@@ -231,8 +265,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === setURLPrefix) {
const operation: ReplaceKeyserverOperation = {
@@ -246,8 +283,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === updateLastCommunicatedPlatformDetailsActionType) {
const { keyserverID, platformDetails } = action.payload;
@@ -262,8 +302,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === keyserverRegisterActionTypes.success) {
const operation: ReplaceKeyserverOperation = {
@@ -277,8 +320,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === updateConnectionStatusActionType) {
const { keyserverID, status } = action.payload;
@@ -297,8 +343,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === unsupervisedBackgroundActionType) {
const { keyserverID } = action.payload;
@@ -317,8 +366,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === queueActivityUpdatesActionType) {
const { activityUpdates, keyserverID } = action.payload;
@@ -355,8 +407,11 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === updateActivityActionTypes.success) {
const { activityUpdates } = action.payload;
@@ -381,8 +436,11 @@
});
}
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ },
+ keyserverStoreOperations: operations,
};
} else if (
action.type === logOutActionTypes.success ||
@@ -410,8 +468,11 @@
});
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ },
+ keyserverStoreOperations: operations,
};
} else if (action.type === setLateResponseActionType) {
const { messageID, isLate, keyserverID } = action.payload;
@@ -438,8 +499,11 @@
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === updateDisconnectedBarActionType) {
const { keyserverID } = action.payload;
@@ -457,8 +521,11 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
} else if (action.type === setDeviceTokenActionTypes.success) {
const { deviceTokens } = action.payload;
@@ -476,8 +543,11 @@
});
}
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, operations),
+ },
+ keyserverStoreOperations: operations,
};
} else if (action.type === setConnectionIssueActionType) {
const { connectionIssue, keyserverID } = action.payload;
@@ -495,10 +565,16 @@
},
};
return {
- ...state,
- keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ keyserverStore: {
+ ...state,
+ keyserverInfos: processStoreOps(state.keyserverInfos, [operation]),
+ },
+ keyserverStoreOperations: [operation],
};
}
- return state;
+ return {
+ keyserverStore: state,
+ keyserverStoreOperations: [],
+ };
}
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
@@ -77,7 +77,7 @@
reduceMessageStore(state.messageStore, action, threadInfos);
let messageStore = reducedMessageStore;
- let keyserverStore = reduceKeyserverStore(state.keyserverStore, action);
+ let { keyserverStore } = reduceKeyserverStore(state.keyserverStore, action);
if (
action.type !== incrementalStateSyncActionType &&

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 7:27 PM (8 h, 32 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2700895
Default Alt Text
D10773.id35949.diff (10 KB)

Event Timeline