[Auto-Logout] Updated Context Menu State (#1201)

* Added context menu states

* Refactored title logic

Co-authored-by: Vincent Salucci <vsalucci@bitwarden.com>
This commit is contained in:
Vincent Salucci 2020-04-07 19:19:47 -05:00 committed by GitHub
parent 02b0f15c6d
commit a96a20e1ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View File

@ -91,6 +91,9 @@
"vaultLocked": { "vaultLocked": {
"message": "Vault is locked." "message": "Vault is locked."
}, },
"vaultLoggedOut": {
"message": "Vault is logged out."
},
"autoFillInfo": { "autoFillInfo": {
"message": "There are no logins available to auto-fill for the current browser tab." "message": "There are no logins available to auto-fill for the current browser tab."
}, },

View File

@ -286,7 +286,7 @@ export default class MainBackground {
} }
if (forLocked) { if (forLocked) {
await this.loadMenuAndUpdateBadgeForLockedState(!menuDisabled); await this.loadMenuAndUpdateBadgeForNoAccessState(!menuDisabled);
this.onUpdatedRan = this.onReplacedRan = false; this.onUpdatedRan = this.onReplacedRan = false;
return; return;
} }
@ -513,12 +513,13 @@ export default class MainBackground {
} catch { } } catch { }
} }
await this.loadMenuAndUpdateBadgeForLockedState(contextMenuEnabled); await this.loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled);
} }
private async loadMenuAndUpdateBadgeForLockedState(contextMenuEnabled: boolean) { private async loadMenuAndUpdateBadgeForNoAccessState(contextMenuEnabled: boolean) {
if (contextMenuEnabled) { 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(); const tabs = await BrowserApi.getActiveTabs();