Fixed UI inconsistencies when finer-grained contextual policies are created/imported by other means (thans barbaz for reporting).

This commit is contained in:
hackademix 2023-07-02 16:25:01 +02:00
parent 2fd3b981af
commit ba71f20474
No known key found for this signature in database
GPG Key ID: 231A83AFDA9C2434
1 changed files with 3 additions and 3 deletions

View File

@ -690,8 +690,8 @@ var UI = (() => {
for (let child; child = ctxSelect.firstChild;) child.remove(); for (let child; child = ctxSelect.firstChild;) child.remove();
ctxSelect.appendChild(entry("*", _("anySite"))); ctxSelect.appendChild(entry("*", _("anySite")));
if (this.mainDomain) { if (this.mainDomain) {
let key = Sites.optimalKey(this.mainUrl); const key = row.contextMatch || Sites.optimalKey(this.mainUrl);
ctxSelect.appendChild(entry(key, toLabel(key))).selected = key === row.contextMatch; ctxSelect.appendChild(entry(key, toLabel(key))).selected = !!row.contextMatch;
} else { } else {
if (!row._customPerms) row._customPerms = row.perms; if (!row._customPerms) row._customPerms = row.perms;
let ctxSites = row._customPerms.contextual; let ctxSites = row._customPerms.contextual;
@ -876,7 +876,7 @@ var UI = (() => {
if (!hasTemp) hasTemp = perms.temp; if (!hasTemp) hasTemp = perms.temp;
} }
} else { } else {
let top = Sites.optimalKey(this.mainUrl); const top = this.mainUrl;
for (let site of sites) { for (let site of sites) {
let context = top; let context = top;
if (site.site) { if (site.site) {