Milestones: a recorded mark stays done whatever its stamp
The done-check read the stored value, so a mark recorded as 0 counted as never celebrated. Seeding the already-passed hundreds that way would have made the site announce "400 members" to a channel watching 528. It now tests that the mark is present at all. Caught before it posted; the live state has been re-stamped either way. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
+3
-1
@@ -153,7 +153,9 @@ async function milestoneTick() {
|
|||||||
const sc = X.siteConfig(); if (!sc.telegramBotToken) return null;
|
const sc = X.siteConfig(); if (!sc.telegramBotToken) return null;
|
||||||
const st = state(); const done = st.milestones || {};
|
const st = state(); const done = st.milestones || {};
|
||||||
const count = await memberCount();
|
const count = await memberCount();
|
||||||
const due = marksUpTo(count).filter(m => !done[m]);
|
// presence of the key is what counts, never its value: a mark recorded as 0 (or any other
|
||||||
|
// falsy stamp) must stay done, or the ladder back-posts a number the site passed long ago
|
||||||
|
const due = marksUpTo(count).filter(m => !Object.prototype.hasOwnProperty.call(done, m));
|
||||||
if (!due.length) return null;
|
if (!due.length) return null;
|
||||||
const mark = due[due.length - 1];
|
const mark = due[due.length - 1];
|
||||||
const text = composeMilestone(mark, await gather(), sc.telegramCtaUrl);
|
const text = composeMilestone(mark, await gather(), sc.telegramCtaUrl);
|
||||||
|
|||||||
Reference in New Issue
Block a user