diff --git a/.peppa/memory.md b/.peppa/memory.md index 1c7a1f9..2a42ae4 100644 --- a/.peppa/memory.md +++ b/.peppa/memory.md @@ -33,6 +33,7 @@ - BRM-118: причины недоступных кнопок (письмо, stop/resume/send на «Сводке») уже были из BRM-96/98; добавлено только title=причина у stop/resume в server.js; тесты гонять через `env -i PATH HOME npm test`. - BRM-120: на главной причина выключенной отправки — только в списке sendBox (мелкой строки home.send.hint больше нет); время версии одно — в deployBox. - BRM-106/110/122/125: плашка deployBox общая для главной и «Бота и отчётов»: «Обновлено: … по Алматы» + «Что нового для вас» — массив DEPLOY_NOTES в src/site.js (ключи deploy.note.*, по порядку выкладки, новое — в конец), номер истории в скобках; тест BRM-99 перечисляет допустимые номера; спеки deploy-notes нет, требования — в deploy-box. +- 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/ не трогать. diff --git a/locales/en.json b/locales/en.json index 66c3d8c..427a8da 100644 --- a/locales/en.json +++ b/locales/en.json @@ -556,6 +556,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.s.stopWhy": "Sending is already stopped.", "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.noPublishNote": "Nothing is published until the strategy is approved.", "ui.str.fbLabel": "Comment on this version", diff --git a/locales/kk.json b/locales/kk.json index b2c5fc9..ccaad3f 100644 --- a/locales/kk.json +++ b/locales/kk.json @@ -556,6 +556,7 @@ "ui.sum.schedOnNoTg": "Тек кесте қосулы: бұл нұсқада Telegram-ға жіберу өшірулі, жиынтықтар Telegram-ға жөнелтілмейді.", "ui.sum.s.stopWhy": "Жіберу әлдеқашан тоқтатылған.", "ui.sum.s.resumeWhy": "Жіберу әлдеқашан жүріп жатыр.", + "ui.sum.s.resumeWhyNoTg": "Кесте сақталған, бірақ команда бот кілтін бермейінше, жиынтықтар Telegram-ға жіберілмейді. Сондықтан жалғастыратын ештеңе жоқ.", "ui.str.hVersions": "Стратегия нұсқалары", "ui.str.noPublishNote": "Стратегия бекітілгенге дейін ештеңе жарияланбайды.", "ui.str.fbLabel": "Нұсқаға ескерту", diff --git a/locales/ru.json b/locales/ru.json index 84c85a0..56321c6 100644 --- a/locales/ru.json +++ b/locales/ru.json @@ -556,6 +556,7 @@ "ui.sum.schedOnNoTg": "Включено только расписание: на этой версии отправка в Telegram выключена, сводки в Telegram не уходят.", "ui.sum.s.stopWhy": "Рассылка уже остановлена.", "ui.sum.s.resumeWhy": "Рассылка уже идёт.", + "ui.sum.s.resumeWhyNoTg": "Расписание сохранено, но сводки в Telegram не уходят, пока команда не передаст ключ бота. Поэтому возобновлять пока нечего.", "ui.str.hVersions": "Версии стратегии", "ui.str.noPublishNote": "До утверждения стратегии ничего не публикуется.", "ui.str.fbLabel": "Замечание к версии", diff --git a/public/summary.html b/public/summary.html index ecaf2ac..288db5e 100644 --- a/public/summary.html +++ b/public/summary.html @@ -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[,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"); - 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"):""}; $("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()}; diff --git a/src/server.js b/src/server.js index c80e35e..3f6e09f 100644 --- a/src/server.js +++ b/src/server.js @@ -361,7 +361,7 @@ export function createApp({ file, oppsFile, metricsFile, telegram = createTelegr const off = Boolean(pub.status().channels.telegram?.stopped); page = page.replace('

', `

${t(pageLang, off ? "ui.sum.schedOff" : telegram.connected() ? "ui.sum.schedOn" : "ui.sum.schedOnNoTg")}

`); page = page.replace("
", 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; page = page.replace(`