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,7 @@ } from '../actions/user-actions.js'; import { queueActivityUpdatesActionType } from '../types/activity-types.js'; import type { KeyserverInfos, KeyserverStore } from '../types/keyserver-types'; +import { defaultKeyserverInfo } from '../types/keyserver-types.js'; import type { BaseAction } from '../types/redux-types.js'; import { fullStateSyncActionType, @@ -75,14 +76,22 @@ keyserverInfos, }; } else if (action.type === setNewSessionActionType) { - const { keyserverID } = action.payload; + const { keyserverID, urlPrefix } = action.payload; + let previousEntry = state.keyserverInfos[keyserverID]; + if (!previousEntry) { + previousEntry = { + ...defaultKeyserverInfo, + urlPrefix, + }; + } + if (action.payload.sessionChange.cookie !== undefined) { state = { ...state, keyserverInfos: { ...state.keyserverInfos, [keyserverID]: { - ...state.keyserverInfos[keyserverID], + ...previousEntry, cookie: action.payload.sessionChange.cookie, }, }, @@ -94,7 +103,7 @@ keyserverInfos: { ...state.keyserverInfos, [keyserverID]: { - ...state.keyserverInfos[keyserverID], + ...previousEntry, connection: { ...state.keyserverInfos[keyserverID].connection, queuedActivityUpdates: [], diff --git a/lib/socket/socket.react.js b/lib/socket/socket.react.js --- a/lib/socket/socket.react.js +++ b/lib/socket/socket.react.js @@ -506,6 +506,7 @@ logInActionSource: logInActionSources.socketAuthErrorResolutionAttempt, keyserverID: ashoatKeyserverID, + urlPrefix: this.props.urlPrefix, }, }); } @@ -642,6 +643,7 @@ error: null, logInActionSource: undefined, keyserverID: ashoatKeyserverID, + urlPrefix: this.props.urlPrefix, }, }); } diff --git a/lib/types/session-types.js b/lib/types/session-types.js --- a/lib/types/session-types.js +++ b/lib/types/session-types.js @@ -83,6 +83,7 @@ +error: ?string, +logInActionSource: ?LogInActionSource, +keyserverID: string, + +urlPrefix: string, }; export type SessionState = { diff --git a/lib/utils/action-utils.js b/lib/utils/action-utils.js --- a/lib/utils/action-utils.js +++ b/lib/utils/action-utils.js @@ -172,6 +172,7 @@ error: ?string, logInActionSource: ?LogInActionSource, keyserverID: string, + urlPrefix: string, ) { dispatch({ type: setNewSessionActionType, @@ -181,6 +182,7 @@ error, logInActionSource, keyserverID, + urlPrefix, }, }); } @@ -221,6 +223,7 @@ error, logInActionSource, keyserverID, + urlPrefix, ); }; try { @@ -327,6 +330,7 @@ error, undefined, keyserverID, + urlPrefix, ); // This function gets called before callServerEndpoint sends a request, // to make sure that we're not in the middle of trying to recover