Holding tank: 24-hour sign-up grace plus a Who invited you box, the same rules as InstantAdPay (Marty 2026-11-07: "24-hour grace plus the prompt"). One network tank, so both sites behave the same.
Grace: for 24 hours from an account's created time nobody can adopt the person by hand: an Opens in badge, no Adopt button, a plain refusal from adopt(). Auto-assign keeps its clock from the wallet link, so the 24-hour hold is not stretched. The wallet-ready post waits for the grace and says the time really left, is skipped when the rotation takes them in that tick, the arrivals post moves to when the grace ends (marks.claim per member), and the Overview note and weekly email count only people who are open. Prompt: LinkSpin members land on the Control Room, not the /tools Overview, so the box sits at the top of every Control Room screen, /tools included (cr-shell.js). Same checks as InstantAdPay, through setSponsor as a deliberate change with by 'invited', so it follows and clears the hold. With a wallet already linked the engine switches payouts on under the named sponsor right away, as an adoption does, and the confirm box says so first. Nobody invited me hides it everywhere and a small link on /tools brings it back. The named sponsor gets the referral email and an on-site notice (new hooks.notify). Chatbot canned + systemPrompt, KNOWLEDGE_DATE 2026-11-07. cr-shell.js, common.js, credits-screen.js, my.js, admin.js, admin-sponsorcheck.js ?v=20261107tg. qa/tank-hold.test.mjs and qa/sponsorfollow.test.cjs extended; qa/run.sh member now runs tank-hold. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -733,6 +733,7 @@ async function boot() {
|
||||
hooks: { network: (email, address) => networkSponsor(email, address), prefetch: emails => iapFacts(emails, { timeout: 20000 }),
|
||||
iapOwns: (email, o) => iapOwnsTank(email, o), bound: async a => { const id = Number(await chain.memberIdByAccount(a.address)) || 0; if (id) await accounts.setMemberId(a.email, id).catch(() => {}); return id; },
|
||||
payoutBlocked: id => payoutChainBlocked(id, 2), companyId: () => Number(siteConfig().defaultSponsorId) || 1,
|
||||
notify: (email, subject, text) => messages.deliver(1, ADMIN_EMAIL || 'house@' + SITE_HOST, [email], subject, '<p>' + String(text).replace(/&/g, '&').replace(/</g, '<').replace(/>/g, '>').replace(/(https:\/\/[^\s)]+)/g, '<a href="$1" target="_blank" rel="noopener">$1</a>') + '</p>'),
|
||||
lifted: email => tankLifted(email), claim: k => marks.claim(k), assigned: r => { tankPickupPost(r.adopterName, r.adopteeName, true); }, adminAlert: text => tankAdminAlert(text) } });
|
||||
legacy.init({ dataDir: DATA_DIR });
|
||||
traffic.init({ dataDir: DATA_DIR });
|
||||
@@ -1170,7 +1171,11 @@ async function tankNotifyTick() {
|
||||
const f = path.join(DATA_DIR, 'tank-notify.json');
|
||||
let st = { last: 0 }; try { st = JSON.parse(fs.readFileSync(f, 'utf8')); } catch (e) {}
|
||||
const since = st.last || (Date.now() - 24 * 3600 * 1000);
|
||||
const fresh = (await tank.waiting()).filter(w => (w.joined || 0) > since);
|
||||
// sign-up grace (2026-11-07): announced when they can be adopted, 24 hours after sign-up, not when they arrive. graceFrom =
|
||||
// the first run of this rule: anyone who joined before it was already announced at sign-up.
|
||||
const graceFrom = st.graceFrom || (st.graceFrom = st.last || Date.now());
|
||||
const fresh = [];
|
||||
for (const w of tank.openedSince(await tank.waiting(), since)) if ((w.joined || 0) > graceFrom && await marks.claim('tankopen:' + w.email + ':' + (w.joined || 0))) fresh.push(w);
|
||||
st.last = Date.now(); fs.writeFileSync(f, JSON.stringify(st));
|
||||
if (!fresh.length) return;
|
||||
const named = fresh.filter(w => w.username).map(w => '@' + w.username);
|
||||
@@ -1265,10 +1270,10 @@ async function tankReadyTick() {
|
||||
const clean = t => String(t || '').replace(/[<>&]/g, '');
|
||||
const link = SITE_URL + '/tools#line';
|
||||
if (r.fresh.length <= 3) {
|
||||
for (const w of r.fresh) await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} <b>LinkSpin</b> \u00b7 ' + (w.username ? '@' + clean(w.username) : 'A new member') + ' linked a wallet and is ready to switch on payouts. Adopt them from the holding tank in the next 24 hours: ' + link, sc.telegramEchoTopicId).catch(() => {});
|
||||
for (const w of r.fresh) await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} <b>LinkSpin</b> \u00b7 ' + (w.username ? '@' + clean(w.username) : 'A new member') + ' linked a wallet and is ready to switch on payouts. Adopt them from the holding tank in the next ' + tank.leftText(w.until - Date.now()) + ': ' + link, sc.telegramEchoTopicId).catch(() => {});
|
||||
} else { // first run after deploy (the members already linked) or a busy quarter hour: one digest, not a wall of posts
|
||||
const named = r.fresh.filter(w => w.username).map(w => '@' + clean(w.username));
|
||||
await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} <b>LinkSpin</b> \u00b7 ' + r.fresh.length + ' members linked a wallet and are ready to switch on payouts' + (named.length ? ': ' + named.slice(0, 12).join(', ') + (named.length > 12 ? ' and ' + (named.length - 12) + ' more' : '') : '') + '. Adopt them from the holding tank in the next 24 hours: ' + link, sc.telegramEchoTopicId).catch(() => {});
|
||||
await telegramSend(sc.telegramEchoChatId, '\u{1F7E2} <b>LinkSpin</b> \u00b7 ' + r.fresh.length + ' members linked a wallet and are ready to switch on payouts' + (named.length ? ': ' + named.slice(0, 12).join(', ') + (named.length > 12 ? ' and ' + (named.length - 12) + ' more' : '') : '') + '. Adopt them from the holding tank in the next ' + tank.leftText(Math.min(...r.fresh.map(w => w.until)) - Date.now()) + ': ' + link, sc.telegramEchoTopicId).catch(() => {});
|
||||
}
|
||||
return r;
|
||||
}
|
||||
@@ -2042,6 +2047,7 @@ const server = http.createServer(async (req, res) => {
|
||||
const out = { signedIn: true, sponsorBlocked, sponsorName: spdMe.name || null, email: s.email || (acct && acct.email) || null,
|
||||
address: s.address || (acct && acct.address) || null, memberId,
|
||||
username: (acct && acct.username) || null, theme: (acct && acct.theme) || null,
|
||||
inviteAsk: !memberId && acct ? tank.inviteAsk(acct) : null, // the Who invited you card (2026-11-07)
|
||||
refCode: (acct && acct.code) || null, sponsorId, tankHold,
|
||||
// profile + line-banner fields so the Profile pane repopulates on reload (were being saved but not returned)
|
||||
avatarUrl: (acct && acct.avatarUrl) || null, bio: (acct && acct.bio) || null,
|
||||
@@ -2069,7 +2075,7 @@ const server = http.createServer(async (req, res) => {
|
||||
let tankWaiting = null; // top of every Overview: people waiting for a sponsor (Marty, 2026-09-12)
|
||||
try {
|
||||
if (!tankWaitCache || Date.now() - tankWaitCache.ts > 60000) tankWaitCache = { ts: Date.now(), list: await tank.waiting() };
|
||||
const tw = tankWaitCache.list;
|
||||
const tw = tank.adoptableOf(tankWaitCache.list); // only people who can be adopted right now (sign-up grace, 2026-11-07)
|
||||
tankWaiting = { count: tw.length, names: tw.slice(0, 6).map(w => w.name), eligible: !!(await tank.eligibility(s.email)).ok, ready: tw.filter(w => w.ready).length };
|
||||
} catch (e) {}
|
||||
const sc0 = siteConfig();
|
||||
@@ -2530,6 +2536,19 @@ const server = http.createServer(async (req, res) => {
|
||||
if (r.ok) tankPickupPost(r.adopterName, r.adopteeName, false); // tell the payments topic who picked whom up (Marty, 2026-09-12)
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
// "Who invited you?" (Marty approved 2026-11-07): the signed-in member names their own sponsor. check: validate only.
|
||||
if (p === '/api/my/tank/invited' && req.method === 'POST') {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
const b = await readBody(req);
|
||||
const r = await tank.nameSponsor(s.email, b.who, { check: !!b.check });
|
||||
return json(res, r.error ? 400 : 200, r);
|
||||
}
|
||||
if (p === '/api/my/tank/invited/dismiss' && req.method === 'POST') { // "Nobody invited me": hides the card, nothing else changes
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
return json(res, 200, tank.dismissInvite(s.email));
|
||||
}
|
||||
if (p === '/api/my/tank/release' && req.method === 'POST') {
|
||||
const s = await auth.fromRequest(req);
|
||||
if (!s || !s.email) return json(res, 401, { error: 'Sign in first.' });
|
||||
|
||||
Reference in New Issue
Block a user