From ba71f204749a8781ea2680dbcff57de6ccfff907 Mon Sep 17 00:00:00 2001 From: hackademix Date: Sun, 2 Jul 2023 16:25:01 +0200 Subject: [PATCH] Fixed UI inconsistencies when finer-grained contextual policies are created/imported by other means (thans barbaz for reporting). --- src/ui/ui.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ui/ui.js b/src/ui/ui.js index 7a3fb6b..8b940fb 100644 --- a/src/ui/ui.js +++ b/src/ui/ui.js @@ -690,8 +690,8 @@ var UI = (() => { for (let child; child = ctxSelect.firstChild;) child.remove(); ctxSelect.appendChild(entry("*", _("anySite"))); if (this.mainDomain) { - let key = Sites.optimalKey(this.mainUrl); - ctxSelect.appendChild(entry(key, toLabel(key))).selected = key === row.contextMatch; + const key = row.contextMatch || Sites.optimalKey(this.mainUrl); + ctxSelect.appendChild(entry(key, toLabel(key))).selected = !!row.contextMatch; } else { if (!row._customPerms) row._customPerms = row.perms; let ctxSites = row._customPerms.contextual; @@ -876,7 +876,7 @@ var UI = (() => { if (!hasTemp) hasTemp = perms.temp; } } else { - let top = Sites.optimalKey(this.mainUrl); + const top = this.mainUrl; for (let site of sites) { let context = top; if (site.site) {