BTC4Hits import, round 2: tank cap 10 at one time (setting tankAdoptCap) with tests; BTC4Hits origin kept on carried shells (joinedRef btc4hits) and the adoption note/email/auto-assign message say their BTC4Hits account moved here; imported spin links may carry every valid URL (admin route maxDests up to 2000, one save per batch), editor shows 50 rows of a big link with Show all, Check now runs in the background past 50, at most one pause email per link per day; chatbot knows /from/btc4hits + the cap (KNOWLEDGE_DATE 2026-11-11). qa: tank-cap 15/15, tank-hold all passed, btc4hits-bridge 21/21, sponsorfollow 30/30
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -12,10 +12,10 @@ const fs = require('fs');
|
||||
const path = require('path');
|
||||
const db = require('./db');
|
||||
|
||||
// How many people an adopter may hold from the tank AT ONE TIME (Marty 2026-11-11, for the ~1,200 BTC4Hits imports; was 2 open
|
||||
// How many people an adopter may hold from the tank AT ONE TIME (Marty 2026-11-11, for the ~1,200 BTC4Hits imports, 6 then 10 the same day; was 2 open
|
||||
// adoptions): open adoptions whose person has not switched payouts on yet (no member id). Activating frees the slot at once; the
|
||||
// 7-day window closes the rest as before. Site setting tankAdoptCap, default 6.
|
||||
const CAP_DEFAULT = 6; let capFn = () => CAP_DEFAULT;
|
||||
// 7-day window closes the rest as before. Site setting tankAdoptCap, default 10.
|
||||
const CAP_DEFAULT = 10; let capFn = () => CAP_DEFAULT;
|
||||
const capOpen = () => { const n = Math.round(Number(capFn())); return n >= 1 && n <= 50 ? n : CAP_DEFAULT; };
|
||||
async function holding(open) { const out = []; for (const ad of open || []) { const a = await accounts.byEmail(ad.adoptee); if (!(a && Number(a.memberId) > 0)) out.push(ad); } return out; }
|
||||
const TTL_MS = 7 * 86400000; // an adoption's window to convert
|
||||
@@ -143,7 +143,10 @@ async function adopt(adopterEmail, who, note, opts) {
|
||||
const r = await setSponsor(target.email, token, 'adopt');
|
||||
if (r.error) return r;
|
||||
const now = Date.now();
|
||||
const text = String(note || '').trim().slice(0, 600) || ('Hi, I am ' + nameOf(me) + '. You joined LinkSpin without a sponsor, so I picked you up from the holding tank. I will walk you through the first three steps whenever you are ready. Reply here.');
|
||||
const tgt0 = await accounts.byEmail(target.email); const b4h = !!(tgt0 && (tgt0.joinedRef === 'btc4hits' || tgt0.joinedVia === 'btc4hits')); // a BTC4Hits import (2026-11-11): they never joined LinkSpin themselves
|
||||
const text = String(note || '').trim().slice(0, 600) || (b4h
|
||||
? 'Hi, I am ' + nameOf(me) + '. Your BTC4Hits account moved to LinkSpin without a sponsor, so I picked you up from the holding tank. I will walk you through the first three steps whenever you are ready. Reply here.'
|
||||
: 'Hi, I am ' + nameOf(me) + '. You joined LinkSpin without a sponsor, so I picked you up from the holding tank. I will walk you through the first three steps whenever you are ready. Reply here.');
|
||||
const ad = await impl().add({ adoptee: target.email, adopter: e, ts: now, expires: now + TTL_MS, status: 'open', note: (opts && opts.recordNote) || text });
|
||||
{ const rr = RS.load().ready[target.email]; if (rr && !rr.done) { rr.done = clock(); rr.adoptedBy = e; RS.save(); } } // the hold lifts: their sponsor resolves now
|
||||
// wallet already linked: the engine switches their payouts on under the adopter right away (Marty approved 2026-10-27)
|
||||
@@ -158,7 +161,9 @@ async function adopt(adopterEmail, who, note, opts) {
|
||||
if (mailer && mailer.hasKey()) {
|
||||
try {
|
||||
await mailer.send(target.email, nameOf(me) + ' is now your sponsor on LinkSpin',
|
||||
'You joined LinkSpin without a sponsor. ' + nameOf(me) + ' has picked you up from the holding tank and is your sponsor now, which means a real person to walk you through the first steps.\n\nTheir message:\n\n' + text + payLine + '\n\nReply in your member area: ' + siteUrl + '/my#messages\n\nLinkSpin');
|
||||
b4h
|
||||
? 'BTC4Hits has moved to LinkSpin, and your BTC4Hits account came with you. ' + nameOf(me) + ' has picked you up from the holding tank and is your sponsor now, which means a real person to walk you through the first steps.\n\nTheir message:\n\n' + text + payLine + '\n\nSign in with the email you used on BTC4Hits (we send you a code, no password) and reply in your member area: ' + siteUrl + '/from/btc4hits\n\nLinkSpin'
|
||||
: 'You joined LinkSpin without a sponsor. ' + nameOf(me) + ' has picked you up from the holding tank and is your sponsor now, which means a real person to walk you through the first steps.\n\nTheir message:\n\n' + text + payLine + '\n\nReply in your member area: ' + siteUrl + '/my#messages\n\nLinkSpin');
|
||||
} catch (err) {}
|
||||
if (auto) {
|
||||
try {
|
||||
@@ -489,7 +494,7 @@ async function autoAssignRun() {
|
||||
if ((await holding(await impl().open(c.a.email))).length >= capOpen()) continue;
|
||||
if (hooks.payoutBlocked && await Promise.resolve(hooks.payoutBlocked(Number(c.a.memberId))).catch(() => true)) continue; // no-payout chain: they would fall to the company after all
|
||||
if (await inDownlineOf(e, c.a)) continue;
|
||||
const msg = 'Hi, I am ' + nameOf(c.a) + '. You joined LinkSpin without a sponsor and nobody picked you up from the holding tank within 24 hours, so you were matched with me. I will walk you through the first steps whenever you are ready. Reply here.';
|
||||
const msg = 'Hi, I am ' + nameOf(c.a) + '. ' + ((a.joinedVia === 'btc4hits' || a.joinedRef === 'btc4hits') ? 'Your BTC4Hits account moved to LinkSpin' : 'You joined LinkSpin') + ' without a sponsor and nobody picked you up from the holding tank within 24 hours, so you were matched with me. I will walk you through the first steps whenever you are ready. Reply here.';
|
||||
const r = await adopt(c.a.email, a.username || e, msg, { auto: true, recordNote: 'auto-assigned after 24 hours in the tank' });
|
||||
if (r && r.ok) { done = { adoptee: e, adopter: c.a.email, adopterName: r.adopterName, adopteeName: r.adopteeName }; break; }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user