Page MenuHomePhabricator

D13955.id.diff
No OneTemporary

D13955.id.diff

diff --git a/lib/actions/user-actions.js b/lib/actions/user-actions.js
--- a/lib/actions/user-actions.js
+++ b/lib/actions/user-actions.js
@@ -91,6 +91,7 @@
import { authoritativeKeyserverID } from '../utils/authoritative-keyserver.js';
import { getConfig } from '../utils/config.js';
import { getMessageForException } from '../utils/errors.js';
+import { useDispatchActionPromise } from '../utils/redux-promise-utils.js';
import { useSelector } from '../utils/redux-utils.js';
import { usingCommServicesAccessToken } from '../utils/services-utils.js';
import sleep from '../utils/sleep.js';
@@ -267,6 +268,39 @@
}, [commServicesAccessToken, identityClient, preRequestUserState]);
}
+function useInvalidCSATLogOut(): () => Promise<void> {
+ const dispatchActionPromise = useDispatchActionPromise();
+
+ const preRequestUserState = usePreRequestUserState();
+ const callKeyserverLogOut = useKeyserverCall(keyserverLogOut);
+
+ const commServicesAccessToken = useSelector(
+ state => state.commServicesAccessToken,
+ );
+
+ return React.useCallback(() => {
+ const keyserverLogOutPromise = async () => {
+ // errors are swallowed inside `keyserverLogOut` above
+ const { keyserverIDs: _, ...result } = await callKeyserverLogOut({
+ preRequestUserState,
+ });
+ return {
+ ...result,
+ preRequestUserState: {
+ ...result.preRequestUserState,
+ commServicesAccessToken,
+ },
+ };
+ };
+ return dispatchActionPromise(logOutActionTypes, keyserverLogOutPromise());
+ }, [
+ dispatchActionPromise,
+ commServicesAccessToken,
+ callKeyserverLogOut,
+ preRequestUserState,
+ ]);
+}
+
const primaryDeviceLogOutOptions = Object.freeze({
logOutType: 'primary_device',
});
@@ -1449,4 +1483,5 @@
processNewUserIDsActionType,
versionSupportedByIdentityActionTypes,
useVersionSupportedByIdentity,
+ useInvalidCSATLogOut,
};

File Metadata

Mime Type
text/plain
Expires
Tue, Dec 24, 1:12 AM (13 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2697707
Default Alt Text
D13955.id.diff (1 KB)

Event Timeline