[bug] Disable the preferences screen if there is no active unlocked vault (#1270)

This commit is contained in:
Addison Beck 2022-01-26 12:32:00 -05:00 committed by GitHub
parent ff7dd4ad8f
commit 058be7e895
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 2 deletions

View File

@ -50,19 +50,22 @@ export class BitwardenMenu implements IMenubarMenu {
private readonly _messagingService: MessagingService; private readonly _messagingService: MessagingService;
private readonly _accounts: { [userId: string]: MenuAccount }; private readonly _accounts: { [userId: string]: MenuAccount };
private readonly _window: BrowserWindow; private readonly _window: BrowserWindow;
private readonly _isLocked: boolean;
constructor( constructor(
i18nService: I18nService, i18nService: I18nService,
messagingService: MessagingService, messagingService: MessagingService,
updater: UpdaterMain, updater: UpdaterMain,
window: BrowserWindow, window: BrowserWindow,
accounts: { [userId: string]: MenuAccount } accounts: { [userId: string]: MenuAccount },
isLocked: boolean
) { ) {
this._i18nService = i18nService; this._i18nService = i18nService;
this._updater = updater; this._updater = updater;
this._messagingService = messagingService; this._messagingService = messagingService;
this._window = window; this._window = window;
this._accounts = accounts; this._accounts = accounts;
this._isLocked = isLocked;
} }
private get hasAccounts(): boolean { private get hasAccounts(): boolean {
@ -99,6 +102,7 @@ export class BitwardenMenu implements IMenubarMenu {
label: this.localize(process.platform === "darwin" ? "preferences" : "settings"), label: this.localize(process.platform === "darwin" ? "preferences" : "settings"),
click: () => this.sendMessage("openSettings"), click: () => this.sendMessage("openSettings"),
accelerator: "CmdOrCtrl+,", accelerator: "CmdOrCtrl+,",
enabled: !this._isLocked,
}; };
} }

View File

@ -67,7 +67,8 @@ export class Menubar {
messagingService, messagingService,
updaterMain, updaterMain,
windowMain.win, windowMain.win,
updateRequest?.accounts updateRequest?.accounts,
isLocked
), ),
new FileMenu(i18nService, messagingService, isLocked), new FileMenu(i18nService, messagingService, isLocked),
new EditMenu(i18nService, messagingService, isLocked), new EditMenu(i18nService, messagingService, isLocked),