Fix regression in notificationBar (#2314)

(cherry picked from commit 2844e06aa8)
This commit is contained in:
Daniel James Smith 2022-02-07 11:31:18 +01:00 committed by Daniel James Smith
parent d47cdbcd60
commit 65b493cce0
No known key found for this signature in database
GPG Key ID: 03E4BD365FF06726
1 changed files with 22 additions and 13 deletions

View File

@ -48,23 +48,32 @@ document.addEventListener("DOMContentLoaded", (event) => {
let disabledAddLoginNotification = false;
let disabledChangedPasswordNotification = false;
chrome.storage.local.get("neverDomains", (ndObj: any) => {
const domains = ndObj.neverDomains;
const activeUserIdKey = "activeUserId";
let activeUserId: string;
chrome.storage.local.get(activeUserIdKey, (obj: any) => {
if (obj == null || obj[activeUserIdKey] == null) {
return;
}
activeUserId = obj[activeUserIdKey];
});
chrome.storage.local.get(activeUserId, (obj: any) => {
if (obj === null) {
return;
}
const domains = obj[activeUserId].settings.neverDomains;
if (domains != null && domains.hasOwnProperty(window.location.hostname)) {
return;
}
chrome.storage.local.get("disableAddLoginNotification", (disAddObj: any) => {
disabledAddLoginNotification =
disAddObj != null && disAddObj.disableAddLoginNotification === true;
chrome.storage.local.get("disableChangedPasswordNotification", (disChangedObj: any) => {
disabledChangedPasswordNotification =
disChangedObj != null && disChangedObj.disableChangedPasswordNotification === true;
if (!disabledAddLoginNotification || !disabledChangedPasswordNotification) {
collectIfNeededWithTimeout();
}
});
});
disabledAddLoginNotification = obj[activeUserId].settings.disableAddLoginNotification;
disabledChangedPasswordNotification =
obj[activeUserId].settings.disableChangedPasswordNotification;
if (!disabledAddLoginNotification || !disabledChangedPasswordNotification) {
collectIfNeededWithTimeout();
}
});
chrome.runtime.onMessage.addListener((msg: any, sender: any, sendResponse: Function) => {