BTC4Hits import, round 2: tank cap 10 at one time (setting tankAdoptCap), BTC4Hits wording in the adoption note/email/auto-assign message, lssync rows carry origin btc4hits (not hashed), chatbot knows the import + the cap (KNOWLEDGE_DATE 2026-11-11). qa: tank-cap 13/13, tank-hold all passed, sponsorfollow 30/30, sponsorfollow-e2e 24/24
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -11,10 +11,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
|
||||
@@ -148,7 +148,8 @@ 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 InstantAdPay 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.joinedVia === 'btc4hits' || tgt0.joinedRef === 'btc4hits')); // a BTC4Hits import (2026-11-11)
|
||||
const text = String(note || '').trim().slice(0, 600) || ('Hi, I am ' + nameOf(me) + '. ' + (b4h ? 'Your BTC4Hits account moved to InstantAdPay' : 'You joined InstantAdPay') + ' 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 = now; rr.adoptedBy = e; RS.save(); } } // the hold lifts: their sponsor resolves now
|
||||
payTrack(target.email, e, ad.id, auto); // switch-on-payouts reminders at 24 h and 72 h (payTick)
|
||||
@@ -157,7 +158,7 @@ async function adopt(adopterEmail, who, note, opts) {
|
||||
if (mailer && mailer.hasKey()) {
|
||||
try {
|
||||
await mailer.send(target.email, nameOf(me) + ' is now your sponsor on InstantAdPay',
|
||||
'You joined InstantAdPay 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 + '\n\n' + mailPayBlock(nameOf(me), link, !!target.wallet) + '\n\nReply in your member area: ' + siteUrl + '/my#messages\n\nInstantAdPay');
|
||||
(b4h ? 'BTC4Hits has closed, and your BTC4Hits account came over to InstantAdPay with the same email. ' : 'You joined InstantAdPay 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 + '\n\n' + mailPayBlock(nameOf(me), link, !!target.wallet) + '\n\nReply in your member area: ' + siteUrl + '/my#messages\n\nInstantAdPay');
|
||||
} catch (err) {}
|
||||
if (auto) {
|
||||
try {
|
||||
@@ -455,7 +456,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 InstantAdPay 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 InstantAdPay' : 'You joined InstantAdPay') + ' 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