diff --git a/lib/components/keyserver-connection-handler.js b/lib/components/keyserver-connection-handler.js --- a/lib/components/keyserver-connection-handler.js +++ b/lib/components/keyserver-connection-handler.js @@ -89,7 +89,7 @@ React.useEffect(() => { if ( hasConnectionIssue && - keyserverID === authoritativeKeyserverID && + keyserverID === authoritativeKeyserverID() && relyingOnAuthoritativeKeyserver ) { void dispatchActionPromise(logOutActionTypes, callLogOut()); diff --git a/lib/keyserver-conn/recovery-utils.js b/lib/keyserver-conn/recovery-utils.js --- a/lib/keyserver-conn/recovery-utils.js +++ b/lib/keyserver-conn/recovery-utils.js @@ -7,6 +7,7 @@ setNewSession, type CallKeyserverEndpoint, } from './keyserver-conn-types.js'; +import { logOutActionTypes, useLogOut } from '../actions/user-actions.js'; import { cookieSelector, sessionIDSelector, @@ -20,6 +21,7 @@ genericCookieInvalidation, type PreRequestUserState, } from '../types/session-types.js'; +import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js'; import callSingleKeyServerEndpoint from '../utils/call-single-keyserver-endpoint.js'; import type { CallSingleKeyserverEndpoint, @@ -27,8 +29,12 @@ } from '../utils/call-single-keyserver-endpoint.js'; import { getConfig } from '../utils/config.js'; import { promiseAll } from '../utils/promises.js'; +import { useDispatchActionPromise } from '../utils/redux-promise-utils.js'; import { useSelector, useDispatch } from '../utils/redux-utils.js'; -import { usingCommServicesAccessToken } from '../utils/services-utils.js'; +import { + usingCommServicesAccessToken, + relyingOnAuthoritativeKeyserver, +} from '../utils/services-utils.js'; // This function is a shortcut that tells us whether it's worth even trying to // call resolveKeyserverSessionInvalidation @@ -166,6 +172,9 @@ const dispatch = useDispatch(); const urlPrefix = useSelector(urlPrefixSelector(keyserverID)); + const logOut = useLogOut(); + const dispatchActionPromise = useDispatchActionPromise(); + const invalidateKeyserverSession = React.useCallback( ( source: RecoveryActionSource, @@ -180,8 +189,14 @@ source, keyserverID, ); + if ( + keyserverID === authoritativeKeyserverID() && + relyingOnAuthoritativeKeyserver + ) { + void dispatchActionPromise(logOutActionTypes, logOut()); + } }, - [dispatch, keyserverID], + [dispatch, keyserverID, dispatchActionPromise, logOut], ); return React.useCallback(