Fixed wrong label for http: sites in contextual policy UI (thanks barbaz for reporting).
This commit is contained in:
parent
a703a075f4
commit
d900caebc4
10
src/ui/ui.js
10
src/ui/ui.js
|
@ -624,18 +624,20 @@ var UI = (() => {
|
||||||
opt.textContent = label;
|
opt.textContent = label;
|
||||||
return opt;
|
return opt;
|
||||||
}
|
}
|
||||||
|
let toLabel = site => {
|
||||||
|
let label = Sites.toExternal(site);
|
||||||
|
return label.includes(":") ? label : `…${label}`;
|
||||||
|
};
|
||||||
for (let child; child = ctxSelect.firstChild;) child.remove();
|
for (let child; child = ctxSelect.firstChild;) child.remove();
|
||||||
ctxSelect.appendChild(entry("*", _("anySite")));
|
ctxSelect.appendChild(entry("*", _("anySite")));
|
||||||
let ctxSites = row.perms.contextual;
|
let ctxSites = row.perms.contextual;
|
||||||
if (this.mainDomain) {
|
if (this.mainDomain) {
|
||||||
let key = Sites.optimalKey(this.mainUrl);
|
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 {
|
} else {
|
||||||
if (ctxSites) {
|
if (ctxSites) {
|
||||||
for (let [site, ctxPerms] of ctxSites.entries()) {
|
for (let [site, ctxPerms] of ctxSites.entries()) {
|
||||||
let label = Sites.toExternal(site);
|
ctxSelect.appendChild(entry(site, toLabel(site))).selected === perms === ctxPerms;
|
||||||
if (!label.includes(":")) label = `…${label}`;
|
|
||||||
ctxSelect.appendChild(entry(site, label)).selected === perms === ctxPerms;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue