Skip to content

Commit

Permalink
Fixed wrong label for http: sites in contextual policy UI (thanks bar…
Browse files Browse the repository at this point in the history
…baz for reporting).
  • Loading branch information
hackademix committed Feb 20, 2022
1 parent a703a07 commit d900cae
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/ui/ui.js
Expand Up @@ -624,18 +624,20 @@ var UI = (() => {
opt.textContent = label;
return opt;
}
let toLabel = site => {
let label = Sites.toExternal(site);
return label.includes(":") ? label : `…${label}`;
};
for (let child; child = ctxSelect.firstChild;) child.remove();
ctxSelect.appendChild(entry("*", _("anySite")));
let ctxSites = row.perms.contextual;
if (this.mainDomain) {
let key = Sites.optimalKey(this.mainUrl);
ctxSelect.appendChild(entry(key, `…${Sites.toExternal(key)}`)).selected = key === row.contextMatch;
ctxSelect.appendChild(entry(key, toLabel(key))).selected = key === row.contextMatch;
} else {
if (ctxSites) {
for (let [site, ctxPerms] of ctxSites.entries()) {
let label = Sites.toExternal(site);
if (!label.includes(":")) label = `…${label}`;
ctxSelect.appendChild(entry(site, label)).selected === perms === ctxPerms;
ctxSelect.appendChild(entry(site, toLabel(site))).selected === perms === ctxPerms;
}
}
}
Expand Down

0 comments on commit d900cae

Please sign in to comment.