mirror of
https://github.com/bitwarden/browser
synced 2025-12-15 15:53:27 +00:00
[PM-4561] Migrate Browser Account Settings (#6886)
* Move Account Settings * Add Another Test * Refactor Tests * Update Notification Bar to Get Value From Global * Also Migrate Disable Context Menu * Add Explanation
This commit is contained in:
@@ -3,7 +3,7 @@ import ChangePasswordRuntimeMessage from "../../background/models/changePassword
|
||||
import AutofillField from "../models/autofill-field";
|
||||
import { WatchedForm } from "../models/watched-form";
|
||||
import { FormData } from "../services/abstractions/autofill.service";
|
||||
import { UserSettings } from "../types";
|
||||
import { GlobalSettings, UserSettings } from "../types";
|
||||
|
||||
interface HTMLElementWithFormOpId extends HTMLElement {
|
||||
formOpId: string;
|
||||
@@ -97,6 +97,7 @@ async function loadNotificationBar() {
|
||||
const userSettingsStorageValue = await getFromLocalStorage(activeUserId);
|
||||
if (userSettingsStorageValue[activeUserId]) {
|
||||
const userSettings: UserSettings = userSettingsStorageValue[activeUserId].settings;
|
||||
const globalSettings: GlobalSettings = await getFromLocalStorage("global");
|
||||
|
||||
// Do not show the notification bar on the Bitwarden vault
|
||||
// because they can add logins and change passwords there
|
||||
@@ -107,11 +108,11 @@ async function loadNotificationBar() {
|
||||
// show the notification bar on (for login detail collection or password change).
|
||||
// It is managed in the Settings > Excluded Domains page in the browser extension.
|
||||
// Example: '{"bitwarden.com":null}'
|
||||
const excludedDomainsDict = userSettings.neverDomains;
|
||||
const excludedDomainsDict = globalSettings.neverDomains;
|
||||
if (!excludedDomainsDict || !(window.location.hostname in excludedDomainsDict)) {
|
||||
// Set local disabled preferences
|
||||
disabledAddLoginNotification = userSettings.disableAddLoginNotification;
|
||||
disabledChangedPasswordNotification = userSettings.disableChangedPasswordNotification;
|
||||
disabledAddLoginNotification = globalSettings.disableAddLoginNotification;
|
||||
disabledChangedPasswordNotification = globalSettings.disableChangedPasswordNotification;
|
||||
|
||||
if (!disabledAddLoginNotification || !disabledChangedPasswordNotification) {
|
||||
// If the user has not disabled both notifications, then handle the initial page change (null -> actual page)
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import { Region } from "@bitwarden/common/platform/abstractions/environment.service";
|
||||
import { GlobalState } from "@bitwarden/common/platform/models/domain/global-state";
|
||||
import { VaultTimeoutAction } from "@bitwarden/common/src/enums/vault-timeout-action.enum";
|
||||
import { CipherType } from "@bitwarden/common/vault/enums/cipher-type";
|
||||
|
||||
@@ -34,13 +35,15 @@ export type UserSettings = {
|
||||
settings: {
|
||||
equivalentDomains: string[][];
|
||||
};
|
||||
neverDomains?: { [key: string]: any };
|
||||
disableAddLoginNotification?: boolean;
|
||||
disableChangedPasswordNotification?: boolean;
|
||||
vaultTimeout: number;
|
||||
vaultTimeoutAction: VaultTimeoutAction;
|
||||
};
|
||||
|
||||
export type GlobalSettings = Pick<
|
||||
GlobalState,
|
||||
"disableAddLoginNotification" | "disableChangedPasswordNotification" | "neverDomains"
|
||||
>;
|
||||
|
||||
/**
|
||||
* A HTMLElement (usually a form element) with additional custom properties added by this script
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user