Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F3361818
D12383.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D12383.diff
View Options
diff --git a/lib/actions/aux-user-actions.js b/lib/actions/aux-user-actions.js
--- a/lib/actions/aux-user-actions.js
+++ b/lib/actions/aux-user-actions.js
@@ -8,9 +8,12 @@
const setPeerDeviceListsActionType = 'SET_PEER_DEVICE_LISTS';
+const removeAllPeerDeviceListsActionType = 'REMOVE_ALL_PEER_DEVICE_LISTS';
+
export {
setAuxUserFIDsActionType,
addAuxUserFIDsActionType,
clearAuxUserFIDsActionType,
setPeerDeviceListsActionType,
+ removeAllPeerDeviceListsActionType,
};
diff --git a/lib/hooks/qr-auth.js b/lib/hooks/qr-auth.js
--- a/lib/hooks/qr-auth.js
+++ b/lib/hooks/qr-auth.js
@@ -3,6 +3,7 @@
import invariant from 'invariant';
import * as React from 'react';
+import { removeAllPeerDeviceListsActionType } from '../actions/aux-user-actions.js';
import { IdentityClientContext } from '../shared/identity-client-context.js';
import { useTunnelbroker } from '../tunnelbroker/tunnelbroker-context.js';
import type { BackupKeys } from '../types/backup-types.js';
@@ -19,6 +20,7 @@
qrCodeAuthMessageTypes,
type QRCodeAuthMessagePayload,
} from '../types/tunnelbroker/qr-code-auth-message-types.js';
+import { useDispatch } from '../utils/redux-utils.js';
type QRAuthHandlerInput = {
+secondaryDeviceID: ?string,
@@ -57,6 +59,8 @@
const identityContext = React.useContext(IdentityClientContext);
const identityClient = identityContext?.identityClient;
+ const dispatch = useDispatch();
+
React.useEffect(() => {
if (
!secondaryDeviceID ||
@@ -124,11 +128,12 @@
qrCodeAuthMessageTypes.BACKUP_DATA_KEY_MESSAGE
) {
const { backupID, backupDataKey, backupLogDataKey } = qrCodeAuthMessage;
- void performBackupRestore?.({
+ await performBackupRestore?.({
backupID,
backupDataKey,
backupLogDataKey,
});
+ dispatch({ type: removeAllPeerDeviceListsActionType });
return;
}
@@ -147,12 +152,13 @@
setUnauthorizedDeviceID(null);
},
[
- setUnauthorizedDeviceID,
identityClient,
aesKey,
performSecondaryDeviceRegistration,
- performBackupRestore,
+ setUnauthorizedDeviceID,
processMessage,
+ performBackupRestore,
+ dispatch,
],
);
diff --git a/lib/reducers/aux-user-reducer.js b/lib/reducers/aux-user-reducer.js
--- a/lib/reducers/aux-user-reducer.js
+++ b/lib/reducers/aux-user-reducer.js
@@ -5,6 +5,7 @@
addAuxUserFIDsActionType,
clearAuxUserFIDsActionType,
setPeerDeviceListsActionType,
+ removeAllPeerDeviceListsActionType,
} from '../actions/aux-user-actions.js';
import { setClientDBStoreActionType } from '../actions/client-db-store-actions.js';
import {
@@ -140,6 +141,22 @@
auxUserStore: processStoreOps(state, replaceOperations),
auxUserStoreOperations: replaceOperations,
};
+ } else if (action.type === removeAllPeerDeviceListsActionType) {
+ const replaceOperations: ReplaceAuxUserInfoOperation[] = [];
+ for (const userID in state.auxUserInfos) {
+ const { deviceList, ...rest } = state.auxUserInfos[userID];
+ replaceOperations.push({
+ type: 'replace_aux_user_info',
+ payload: {
+ id: userID,
+ auxUserInfo: rest,
+ },
+ });
+ }
+ return {
+ auxUserStore: processStoreOps(state, replaceOperations),
+ auxUserStoreOperations: replaceOperations,
+ };
}
return {
diff --git a/lib/types/redux-types.js b/lib/types/redux-types.js
--- a/lib/types/redux-types.js
+++ b/lib/types/redux-types.js
@@ -1412,6 +1412,10 @@
+type: 'SET_PEER_DEVICE_LISTS',
+payload: SetPeerDeviceListsPayload,
}
+ | {
+ +type: 'REMOVE_ALL_PEER_DEVICE_LISTS',
+ +payload?: void,
+ }
| {
+type: 'OPS_PROCESSING_FINISHED_ACTION_TYPE',
+payload?: void,
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Mon, Nov 25, 7:33 PM (21 h, 56 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580810
Default Alt Text
D12383.diff (3 KB)
Attached To
Mode
D12383: [lib] refresh device lists after restore
Attached
Detach File
Event Timeline
Log In to Comment