Merge pull request #694 from keepassxreboot/fix/banner_with_site_preferences

Respect Site Preferences settings with the banner
This commit is contained in:
Sami Vänttinen 2019-12-09 15:30:02 +02:00 committed by GitHub
commit 6df0c5452e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 8 deletions

View file

@ -44,12 +44,8 @@ kpxcBanner.create = async function(credentials = {}) {
}
// Don't show anything if the site is in the ignore
if (kpxc.settings.sitePreferences !== undefined) {
for (const site of kpxc.settings.sitePreferences) {
if (site.ignore !== IGNORE_NOTHING && (site.url === credentials.url || siteMatch(site.url, credentials.url))) {
return;
}
}
if (kpxc.siteIgnored(IGNORE_NORMAL)) {
return;
}
kpxcBanner.created = true;

View file

@ -885,7 +885,7 @@ kpxc.detectDatabaseChange = async function(response) {
};
// Checks if the site has been ignored using Site Preferences
kpxc.siteIgnored = function() {
kpxc.siteIgnored = function(condition) {
kpxc.initializeSitePreferences();
if (kpxc.settings.sitePreferences) {
let currentLocation;
@ -897,9 +897,10 @@ kpxc.siteIgnored = function() {
currentLocation = window.self.location.href;
}
const currentSetting = condition || IGNORE_FULL;
for (const site of kpxc.settings.sitePreferences) {
if (siteMatch(site.url, currentLocation) || site.url === currentLocation) {
if (site.ignore === IGNORE_FULL) {
if (site.ignore === currentSetting) {
return true;
}