BRM-119: без ключа бота у «Возобновить отправку» объяснение вместо «Рассылка уже идёт»
All checks were successful
peppa/lint lint: success за 0с
peppa/test test: success за 2с
ci / checks (pull_request) Successful in 15s
deploy / deploy (pull_request) Successful in 28s

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Peppa 2026-11-17 23:23:53 +05:00
parent c968236e12
commit 4e3e9964bd
7 changed files with 9 additions and 4 deletions

View File

@ -32,6 +32,7 @@
- BRM-107: в письме кнопка lsend называется «Открыть в почте» (письмо само не уходит), порядок шагов — #lsteps (letter.steps), скрыт без письма и после отправки. - BRM-107: в письме кнопка lsend называется «Открыть в почте» (письмо само не уходит), порядок шагов — #lsteps (letter.steps), скрыт без письма и после отправки.
- BRM-108: «Итог по регионам» (regionsBox(lang, coverage, AGREED)) содержит #regtotal «Всего N из M» + согласие; сервер считает из coverage, суммы совпадают. - BRM-108: «Итог по регионам» (regionsBox(lang, coverage, AGREED)) содержит #regtotal «Всего N из M» + согласие; сервер считает из coverage, суммы совпадают.
- BRM-118: причины недоступных кнопок (письмо, stop/resume/send на «Сводке») уже были из BRM-96/98; добавлено только title=причина у stop/resume в server.js; тесты гонять через `env -i PATH HOME npm test`. - BRM-118: причины недоступных кнопок (письмо, stop/resume/send на «Сводке») уже были из BRM-96/98; добавлено только title=причина у stop/resume в server.js; тесты гонять через `env -i PATH HOME npm test`.
- BRM-119: у «Возобновить отправку» без ключа бота причина — ui.sum.s.resumeWhyNoTg (не «Рассылка уже идёт»); выбирает server.js по telegram.connected() и summary.html по st.telegram.
## Команды ## Команды
- BRM-13: Node без зависимостей; `npm test` (сбросить NODE_TEST_CONTEXT, иначе node:test не стартует); lint = node --check src/*.js; dist/ не трогать. - BRM-13: Node без зависимостей; `npm test` (сбросить NODE_TEST_CONTEXT, иначе node:test не стартует); lint = node --check src/*.js; dist/ не трогать.

View File

@ -551,6 +551,7 @@
"ui.sum.schedOnNoTg": "Only the schedule is on: sending to Telegram is off in this version, so summaries are not delivered to Telegram.", "ui.sum.schedOnNoTg": "Only the schedule is on: sending to Telegram is off in this version, so summaries are not delivered to Telegram.",
"ui.sum.s.stopWhy": "Sending is already stopped.", "ui.sum.s.stopWhy": "Sending is already stopped.",
"ui.sum.s.resumeWhy": "Sending is already running.", "ui.sum.s.resumeWhy": "Sending is already running.",
"ui.sum.s.resumeWhyNoTg": "The schedule is saved, but summaries are not sent to Telegram until the team passes on the bot key. So there is nothing to resume yet.",
"ui.str.hVersions": "Strategy versions", "ui.str.hVersions": "Strategy versions",
"ui.str.noPublishNote": "Nothing is published until the strategy is approved.", "ui.str.noPublishNote": "Nothing is published until the strategy is approved.",
"ui.str.fbLabel": "Comment on this version", "ui.str.fbLabel": "Comment on this version",

View File

@ -551,6 +551,7 @@
"ui.sum.schedOnNoTg": "Тек кесте қосулы: бұл нұсқада Telegram-ға жіберу өшірулі, жиынтықтар Telegram-ға жөнелтілмейді.", "ui.sum.schedOnNoTg": "Тек кесте қосулы: бұл нұсқада Telegram-ға жіберу өшірулі, жиынтықтар Telegram-ға жөнелтілмейді.",
"ui.sum.s.stopWhy": "Жіберу әлдеқашан тоқтатылған.", "ui.sum.s.stopWhy": "Жіберу әлдеқашан тоқтатылған.",
"ui.sum.s.resumeWhy": "Жіберу әлдеқашан жүріп жатыр.", "ui.sum.s.resumeWhy": "Жіберу әлдеқашан жүріп жатыр.",
"ui.sum.s.resumeWhyNoTg": "Кесте сақталған, бірақ команда бот кілтін бермейінше, жиынтықтар Telegram-ға жіберілмейді. Сондықтан жалғастыратын ештеңе жоқ.",
"ui.str.hVersions": "Стратегия нұсқалары", "ui.str.hVersions": "Стратегия нұсқалары",
"ui.str.noPublishNote": "Стратегия бекітілгенге дейін ештеңе жарияланбайды.", "ui.str.noPublishNote": "Стратегия бекітілгенге дейін ештеңе жарияланбайды.",
"ui.str.fbLabel": "Нұсқаға ескерту", "ui.str.fbLabel": "Нұсқаға ескерту",

View File

@ -551,6 +551,7 @@
"ui.sum.schedOnNoTg": "Включено только расписание: на этой версии отправка в Telegram выключена, сводки в Telegram не уходят.", "ui.sum.schedOnNoTg": "Включено только расписание: на этой версии отправка в Telegram выключена, сводки в Telegram не уходят.",
"ui.sum.s.stopWhy": "Рассылка уже остановлена.", "ui.sum.s.stopWhy": "Рассылка уже остановлена.",
"ui.sum.s.resumeWhy": "Рассылка уже идёт.", "ui.sum.s.resumeWhy": "Рассылка уже идёт.",
"ui.sum.s.resumeWhyNoTg": "Расписание сохранено, но сводки в Telegram не уходят, пока команда не передаст ключ бота. Поэтому возобновлять пока нечего.",
"ui.str.hVersions": "Версии стратегии", "ui.str.hVersions": "Версии стратегии",
"ui.str.noPublishNote": "До утверждения стратегии ничего не публикуется.", "ui.str.noPublishNote": "До утверждения стратегии ничего не публикуется.",
"ui.str.fbLabel": "Замечание к версии", "ui.str.fbLabel": "Замечание к версии",

View File

@ -68,7 +68,7 @@ async function loadSet(){const[,d]=await api("GET","/api/summary/settings");$("w
const[,l]=await api("GET","/api/summary/log");none($("log"),"ui.sum.logEmpty",l.map(e=>`${when(e.time)} — ${t("ui.sum.log."+(e.result==="published"?"published":e.off?"off":e.reason==="stopped"?"stopped":"failed"))}${e.text?"\n"+e.text:""}`).join("\n\n")); const[,l]=await api("GET","/api/summary/log");none($("log"),"ui.sum.logEmpty",l.map(e=>`${when(e.time)} — ${t("ui.sum.log."+(e.result==="published"?"published":e.off?"off":e.reason==="stopped"?"stopped":"failed"))}${e.text?"\n"+e.text:""}`).join("\n\n"));
const[,st]=await api("GET","/api/summary/status");$("tg").textContent=t(st.telegram?"ui.sum.tgOn":"ui.sum.tgOff")+(st.telegram||!st.missing?"":" "+t("why.tg."+st.missing));$("tg").classList.toggle("on",!!st.telegram); const[,st]=await api("GET","/api/summary/status");$("tg").textContent=t(st.telegram?"ui.sum.tgOn":"ui.sum.tgOff")+(st.telegram||!st.missing?"":" "+t("why.tg."+st.missing));$("tg").classList.toggle("on",!!st.telegram);
PAUSED=!!st.paused;$("sched").textContent=t(PAUSED?"ui.sum.schedOff":st.telegram?"ui.sum.schedOn":"ui.sum.schedOnNoTg"); PAUSED=!!st.paused;$("sched").textContent=t(PAUSED?"ui.sum.schedOff":st.telegram?"ui.sum.schedOn":"ui.sum.schedOnNoTg");
for(const[id,off,why,tip]of[["stop",PAUSED,"ui.sum.s.stopWhy","ui.sum.s.stopTip"],["resume",!PAUSED,"ui.sum.s.resumeWhy","ui.sum.s.resumeTip"]]){const e=$(id);e.classList.toggle("off",off);e.setAttribute("aria-disabled",String(off));e.title=t(off?why:tip);$(id+"why").textContent=off?t(why):""}const b=$("send");b.classList.toggle("off",!st.telegram);b.setAttribute("aria-disabled",String(!st.telegram));b.title=t(st.telegram?"ui.sum.sendTip":"ui.sum.sendOffTip");$("sendwhy").textContent=st.telegram?"":t(st.missing?"why.tg.short."+st.missing:"ui.sum.sendWhy")} for(const[id,off,why,tip]of[["stop",PAUSED,"ui.sum.s.stopWhy","ui.sum.s.stopTip"],["resume",!PAUSED,st.telegram?"ui.sum.s.resumeWhy":"ui.sum.s.resumeWhyNoTg","ui.sum.s.resumeTip"]]){const e=$(id);e.classList.toggle("off",off);e.setAttribute("aria-disabled",String(off));e.title=t(off?why:tip);$(id+"why").textContent=off?t(why):""}const b=$("send");b.classList.toggle("off",!st.telegram);b.setAttribute("aria-disabled",String(!st.telegram));b.title=t(st.telegram?"ui.sum.sendTip":"ui.sum.sendOffTip");$("sendwhy").textContent=st.telegram?"":t(st.missing?"why.tg.short."+st.missing:"ui.sum.sendWhy")}
$("saveset").onclick=async()=>{const[ok,d]=await api("PUT","/api/summary/settings",{weekly:{day:Number($("wday").value),time:$("wtime").value},daily:{enabled:$("den").checked,time:$("dtime").value}});$("err").textContent=ok?"":d.error;$("ok").textContent=ok?t("ui.sum.s.saved"):""}; $("saveset").onclick=async()=>{const[ok,d]=await api("PUT","/api/summary/settings",{weekly:{day:Number($("wday").value),time:$("wtime").value},daily:{enabled:$("den").checked,time:$("dtime").value}});$("err").textContent=ok?"":d.error;$("ok").textContent=ok?t("ui.sum.s.saved"):""};
$("stop").onclick=async()=>{if(PAUSED)return;await api("POST","/api/summary/stop",{});$("ok").textContent=t("ui.sum.s.stopped");loadSet()}; $("stop").onclick=async()=>{if(PAUSED)return;await api("POST","/api/summary/stop",{});$("ok").textContent=t("ui.sum.s.stopped");loadSet()};
$("resume").onclick=async()=>{if(!PAUSED)return;await api("POST","/api/summary/resume",{});$("ok").textContent=t("ui.sum.s.resumed");loadSet()}; $("resume").onclick=async()=>{if(!PAUSED)return;await api("POST","/api/summary/resume",{});$("ok").textContent=t("ui.sum.s.resumed");loadSet()};

View File

@ -361,7 +361,7 @@ export function createApp({ file, oppsFile, metricsFile, telegram = createTelegr
const off = Boolean(pub.status().channels.telegram?.stopped); const off = Boolean(pub.status().channels.telegram?.stopped);
page = page.replace('<p id="sched" class="hint" role="status"></p>', `<p id="sched" class="hint" role="status">${t(pageLang, off ? "ui.sum.schedOff" : telegram.connected() ? "ui.sum.schedOn" : "ui.sum.schedOnNoTg")}</p>`); page = page.replace('<p id="sched" class="hint" role="status"></p>', `<p id="sched" class="hint" role="status">${t(pageLang, off ? "ui.sum.schedOff" : telegram.connected() ? "ui.sum.schedOn" : "ui.sum.schedOnNoTg")}</p>`);
page = page.replace("<table id=\"list\"></table>", metricsTable(pageLang, metrics.list())); 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"]]) { for (const [id, offNow, why] of [["stop", off, "ui.sum.s.stopWhy"], ["resume", !off, telegram.connected() ? "ui.sum.s.resumeWhy" : "ui.sum.s.resumeWhyNoTg"]]) {
if (!offNow) continue; if (!offNow) continue;
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>`); 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>`);
} }

View File

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