BRM-118: причины недоступных кнопок на «Сводке» и в письме #113

Merged
peppa-bot merged 2 commits from task/brm-118 into main 2026-11-17 23:59:56 +05:00
2 changed files with 3 additions and 1 deletions
Showing only changes of commit 82d292c674 - Show all commits

View File

@ -363,7 +363,7 @@ export function createApp({ file, oppsFile, metricsFile, telegram = createTelegr
page = page.replace("<table id=\"list\"></table>", metricsTable(pageLang, metrics.list()));
for (const [id, offNow, why] of [["stop", off, "ui.sum.s.stopWhy"], ["resume", !off, "ui.sum.s.resumeWhy"]]) {
if (!offNow) continue;
page = page.replace(`<button id="${id}" `, `<button id="${id}" class="off" aria-disabled="true" `).replace(`<small id="${id}why"></small>`, `<small id="${id}why">${t(pageLang, why)}</small>`);
page = page.replace(`<button id="${id}" `, `<button id="${id}" class="off" aria-disabled="true" `).replace(new RegExp(`(<button id="${id}"[^>]*?) title="[^"]*"`), `$1 title="${t(pageLang, why)}"`).replace(`<small id="${id}why"></small>`, `<small id="${id}why">${t(pageLang, why)}</small>`);
}
if (!telegram.connected()) page = page.replace('<small id="sendwhy"></small>', `<small id="sendwhy">${t(pageLang, telegram.missing?.() ? "why.tg.short." + telegram.missing() : "ui.sum.sendWhy")}</small>`);
}

View File

@ -92,12 +92,14 @@ test("BRM-96: «Сводка» и письмо до скриптов показ
let h = await (await fetch(base + "/summary.html")).text();
assert.match(h, /<button id="resume" class="off" aria-disabled="true"/);
assert.ok(h.includes('<small id="resumewhy">Рассылка уже идёт.</small>'));
assert.match(h, /id="resume"[^>]*title="Рассылка уже идёт\."/);
assert.match(h, /<button id="stop" data-t/, "«Остановить» доступна, причины нет");
assert.ok(h.includes('<small id="stopwhy"></small>'));
await fetch(base + "/api/summary/stop", { method: "POST", headers: { "content-type": "application/json" }, body: "{}" });
h = await (await fetch(base + "/summary.html")).text();
assert.match(h, /<button id="stop" class="off" aria-disabled="true"/);
assert.ok(h.includes('<small id="stopwhy">Рассылка уже остановлена.</small>'));
assert.match(h, /id="stop"[^>]*title="Рассылка уже остановлена\."/);
assert.ok(h.includes('<small id="resumewhy"></small>'));
const o = await (await fetch(base + "/opportunities.html")).text();
assert.match(o, /id="lmark" disabled aria-disabled="true"/);