From 686c7fbfffd3dc4347825c8e2b60db84a8abc264 Mon Sep 17 00:00:00 2001 From: Daniel James Smith Date: Thu, 30 Sep 2021 16:09:42 +0200 Subject: [PATCH] Pass vault state (locked/unlocked) to notificationBar --- src/background/main.background.ts | 7 +++++++ src/content/notificationBar.ts | 4 ++-- src/notification/bar.js | 1 + 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/background/main.background.ts b/src/background/main.background.ts index bc36b031d5..56d230aeba 100644 --- a/src/background/main.background.ts +++ b/src/background/main.background.ts @@ -676,13 +676,20 @@ export default class MainBackground { if (this.notificationQueue[i].tabId !== tab.id || this.notificationQueue[i].domain !== tabDomain) { continue; } + if (this.notificationQueue[i].type === 'addLogin') { BrowserApi.tabSendMessageData(tab, 'openNotificationBar', { type: 'add', + typeData: { + isVaultLocked: this.notificationQueue[i].wasVaultLocked, + }, }); } else if (this.notificationQueue[i].type === 'changePassword') { BrowserApi.tabSendMessageData(tab, 'openNotificationBar', { type: 'change', + typeData: { + isVaultLocked: this.notificationQueue[i].wasVaultLocked, + }, }); } break; diff --git a/src/content/notificationBar.ts b/src/content/notificationBar.ts index a3e215d411..13c7c7e354 100644 --- a/src/content/notificationBar.ts +++ b/src/content/notificationBar.ts @@ -444,10 +444,10 @@ document.addEventListener('DOMContentLoaded', event => { barPage = barPage + '?success=' + typeData.text; break; case 'add': - barPage = barPage + '?add=1'; + barPage = barPage + '?add=1&isVaultLocked=' + typeData.isVaultLocked; break; case 'change': - barPage = barPage + '?change=1'; + barPage = barPage + '?change=1&isVaultLocked=' + typeData.isVaultLocked; break; default: break; diff --git a/src/notification/bar.js b/src/notification/bar.js index b4d658577e..affa1e81b6 100644 --- a/src/notification/bar.js +++ b/src/notification/bar.js @@ -20,6 +20,7 @@ document.addEventListener('DOMContentLoaded', () => { setTimeout(load, 50); function load() { + const isVaultLocked = getQueryVariable('isVaultLocked') == 'true'; var closeButton = document.getElementById('close-button'), body = document.querySelector('body'), bodyRect = body.getBoundingClientRect();