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 @@ -108,6 +108,10 @@ keyserverInfo: { ...state.keyserverInfos[keyserverID], cookie: null, + connection: { + ...state.keyserverInfos[keyserverID].connection, + sessionRecoveryInProgress: false, + }, }, }, }); @@ -139,44 +143,29 @@ }; } - let newKeyserverInfo = { - ...state.keyserverInfos[keyserverID], - }; - let keyserverUpdated = false; - + let newKeyserverInfo = state.keyserverInfos[keyserverID]; if (sessionChange.cookie !== undefined) { newKeyserverInfo = { ...newKeyserverInfo, cookie: sessionChange.cookie, - }; - keyserverUpdated = true; - } - if (sessionChange.cookieInvalidated) { - newKeyserverInfo = { - ...newKeyserverInfo, connection: { ...newKeyserverInfo.connection, - queuedActivityUpdates: [], + sessionRecoveryInProgress: false, }, }; - keyserverUpdated = true; } - if ( - state.keyserverInfos[keyserverID].connection.sessionRecoveryInProgress && - (gotUserCookie || sessionChange.cookieInvalidated) - ) { + if (sessionChange.cookieInvalidated) { newKeyserverInfo = { ...newKeyserverInfo, connection: { ...newKeyserverInfo.connection, - sessionRecoveryInProgress: false, + queuedActivityUpdates: [], }, }; - keyserverUpdated = true; } const operations: ReplaceKeyserverOperation[] = []; - if (keyserverUpdated) { + if (newKeyserverInfo !== state.keyserverInfos[keyserverID]) { operations.push({ type: 'replace_keyserver', payload: { @@ -213,6 +202,7 @@ connection: { ...state.keyserverInfos[keyserverID].connection, connectionIssue: null, + sessionRecoveryInProgress: false, }, }, }, @@ -488,6 +478,7 @@ connection: { ...oldConnection, connectionIssue: null, + sessionRecoveryInProgress: false, queuedActivityUpdates: [], lateResponses: [], }, @@ -521,6 +512,7 @@ connection: { ...oldConnection, connectionIssue: null, + sessionRecoveryInProgress: false, queuedActivityUpdates: [], lateResponses: [], },