1
0
mirror of https://github.com/bitwarden/browser synced 2025-12-21 10:43:35 +00:00

Correct and test changeover point for userId source in storage migration (#8990)

This commit is contained in:
Matt Gibson
2024-04-30 12:46:01 -04:00
committed by GitHub
parent 3acbffa072
commit 200b0f7534
4 changed files with 15 additions and 14 deletions

View File

@@ -51,17 +51,13 @@ const rollbackJson = () => {
},
global_account_accounts: {
user1: {
profile: {
email: "user1",
name: "User 1",
emailVerified: true,
},
email: "user1",
name: "User 1",
emailVerified: true,
},
user2: {
profile: {
email: "",
emailVerified: false,
},
email: "",
emailVerified: false,
},
},
global_account_activeAccountId: "user1",

View File

@@ -38,8 +38,8 @@ export class KnownAccountsMigrator extends Migrator<59, 60> {
}
async rollback(helper: MigrationHelper): Promise<void> {
// authenticated account are removed, but the accounts record also contains logged out accounts. Best we can do is to add them all back
const accounts = (await helper.getFromGlobal<Record<string, unknown>>(ACCOUNT_ACCOUNTS)) ?? {};
await helper.set("authenticatedAccounts", Object.keys(accounts));
const userIds = (await helper.getKnownUserIds()) ?? [];
await helper.set("authenticatedAccounts", userIds);
await helper.removeFromGlobal(ACCOUNT_ACCOUNTS);
// Active Account Id