Page Menu
Home
Phorge
Search
Configure Global Search
Log In
Files
F32176790
D12605.1765068362.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D12605.1765068362.diff
View Options
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
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';
+import { useBroadcastDeviceListUpdates } from '../hooks/peer-list-hooks.js';
import type {
CallSingleKeyserverEndpoint,
CallSingleKeyserverEndpointOptions,
@@ -15,6 +16,7 @@
import { useKeyserverCall } from '../keyserver-conn/keyserver-call.js';
import type { CallKeyserverEndpoint } from '../keyserver-conn/keyserver-conn-types.js';
import { usePreRequestUserState } from '../selectors/account-selectors.js';
+import { getForeignPeerDevices } from '../selectors/user-selectors.js';
import {
getOneTimeKeyValuesFromBlob,
getPrekeyValueFromBlob,
@@ -52,7 +54,7 @@
import type {
Identities,
IdentityAuthResult,
-} from '../types/identity-service-types';
+} from '../types/identity-service-types.js';
import type {
RawMessageInfo,
MessageTruncationStatuses,
@@ -251,8 +253,21 @@
});
function usePrimaryDeviceLogOut(): () => Promise<LogOutResult> {
+ const broadcastDeviceListUpdates = useBroadcastDeviceListUpdates();
+ const foreignPeerDevices = useSelector(getForeignPeerDevices);
+
const logOut = useLogOut(primaryDeviceLogOutOptions);
- return logOut;
+ return React.useCallback(async () => {
+ // - logOut() performs device list update by calling Identity RPC
+ // - broadcastDeviceListUpdates asks peers to download it from identity
+ // so we need to call them in this order to make sure peers have latest
+ // device list.
+ // We're relying on Tunnelbroker session stil existing after calling logout
+ // and auth metadata not yet cleared at this point.
+ const logOutResult = await logOut();
+ await broadcastDeviceListUpdates(foreignPeerDevices);
+ return logOutResult;
+ }, [broadcastDeviceListUpdates, foreignPeerDevices, logOut]);
}
const secondaryDeviceLogOutOptions = Object.freeze({
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Sun, Dec 7, 12:46 AM (10 h, 49 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
5841730
Default Alt Text
D12605.1765068362.diff (1 KB)
Attached To
Mode
D12605: [lib] Broadcast device list update during primary logout
Attached
Detach File
Event Timeline
Log In to Comment