From a96a20e1ca762f6b8b7294edace61e45f5d8f266 Mon Sep 17 00:00:00 2001 From: Vincent Salucci <26154748+vincentsalucci@users.noreply.github.com> Date: Tue, 7 Apr 2020 19:19:47 -0500 Subject: [PATCH] [Auto-Logout] Updated Context Menu State (#1201) * Added context menu states * Refactored title logic Co-authored-by: Vincent Salucci --- src/_locales/en/messages.json | 3 +++ src/background/main.background.ts | 9 +++++---- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/_locales/en/messages.json b/src/_locales/en/messages.json index e2637fe435..4bdb0c6edd 100644 --- a/src/_locales/en/messages.json +++ b/src/_locales/en/messages.json @@ -91,6 +91,9 @@ "vaultLocked": { "message": "Vault is locked." }, + "vaultLoggedOut": { + "message": "Vault is logged out." + }, "autoFillInfo": { "message": "There are no logins available to auto-fill for the current browser tab." }, diff --git a/src/background/main.background.ts b/src/background/main.background.ts index 036b011dc6..890fea89dc 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -286,7 +286,7 @@ export default class MainBackground { } if (forLocked) { - await this.loadMenuAndUpdateBadgeForLockedState(!menuDisabled); + await this.loadMenuAndUpdateBadgeForNoAccessState(!menuDisabled); this.onUpdatedRan = this.onReplacedRan = false; return; } @@ -513,12 +513,13 @@ export default class MainBackground { } catch { } } - await this.loadMenuAndUpdateBadgeForLockedState(contextMenuEnabled); + await this.loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled); } - private async loadMenuAndUpdateBadgeForLockedState(contextMenuEnabled: boolean) { + private async loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled: boolean) { if (contextMenuEnabled) { - await this.loadNoLoginsContextMenuOptions(this.i18nService.t('vaultLocked')); + const authed = await this.userService.isAuthenticated(); + await this.loadNoLoginsContextMenuOptions(this.i18nService.t(authed ? 'vaultLocked' : 'vaultLoggedOut')); } const tabs = await BrowserApi.getActiveTabs();