mirror of
https://github.com/bitwarden/browser
synced 2025-12-19 09:43:23 +00:00
* Fix error on close due to context differences in background Desktop background does not have active user information. Also, we want to delete _all_ prompt cancelled data, not just that for the active user. Storing this on global and manipulating observables to active achieves this without needing any user information in the background. * Remove potentially orphaned data * Throw nice error if prompt cancelled used without active user * Register migration * split prompt cancelled reset to user-specific and global
24 lines
735 B
TypeScript
24 lines
735 B
TypeScript
import { KeyDefinitionLike, MigrationHelper } from "../migration-helper";
|
|
import { IRREVERSIBLE, Migrator } from "../migrator";
|
|
|
|
export const PROMPT_CANCELLED: KeyDefinitionLike = {
|
|
key: "promptCancelled",
|
|
stateDefinition: { name: "biometricSettings" },
|
|
};
|
|
|
|
export class DeleteBiometricPromptCancelledData extends Migrator<45, 46> {
|
|
async migrate(helper: MigrationHelper): Promise<void> {
|
|
await Promise.all(
|
|
(await helper.getAccounts()).map(async ({ userId }) => {
|
|
if (helper.getFromUser(userId, PROMPT_CANCELLED) != null) {
|
|
await helper.removeFromUser(userId, PROMPT_CANCELLED);
|
|
}
|
|
}),
|
|
);
|
|
}
|
|
|
|
async rollback(helper: MigrationHelper): Promise<void> {
|
|
throw IRREVERSIBLE;
|
|
}
|
|
}
|