Notifications page: count all devices, saying whether this one is included

This commit is contained in:
Astra 2026-10-03 14:08:33 +01:00
parent 17232bd5a2
commit a6960c25a2

View file

@ -553,7 +553,9 @@ async function notifications() {
if (state.page !== "notifications") return;
state.notif = d;
const p = d.prefs;
const others = d.devices.length - (here ? 1 : 0);
// The count row is only worth showing when there's a device besides this one.
const total = d.devices.length;
const others = total - (here ? 1 : 0);
const row = (label, help, control) => `<div class="setting">
<div><b>${label}</b>${help ? `<p>${help}</p>` : ""}</div>
<div class="control">${control}</div>
@ -576,7 +578,7 @@ async function notifications() {
<section class="panel">
<div class="panel-head"><div><h2>Devices</h2></div></div>
${device}
${others > 0 ? row(`${here ? "Other devices" : "Your devices"}`, `${others} ${others === 1 ? "device has" : "devices have"} notifications on.`, '<button class="btn" type="button" data-act="notif-off-all">Turn off everywhere</button>') : ""}
${others > 0 ? row("Your devices", `${total} ${total === 1 ? "device has" : "devices have"} notifications on${here ? ", this one included" : ", not this one"}.`, '<button class="btn" type="button" data-act="notif-off-all">Turn off everywhere</button>') : ""}
</section>
<section class="panel">