Site invite: kind 'promo' for a site's own ready-made video. The email then reads "Here's a short video that shows how it works" and the subject "<sponsor> sent you a video", never that the sender made it; every other word unchanged (Marty 2026-11-21)

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-11-21 12:45:11 -06:00
parent 7ca7514c42
commit 8ae98be870
3 changed files with 20 additions and 6 deletions
+12
View File
@@ -126,5 +126,17 @@ const send = (items, x) => SI.handle('send', Object.assign({ rid: 'rid-' + Math.
for (let i = 0; i < 4; i++) await SI.handle('code', { site: 'videoappincome', email: 'new.person@mail.test', code: '482913' });
r = await SI.handle('code', { site: 'videoappincome', email: 'new.person@mail.test', code: '482913' }); ok(r.code === 'limit', 'the sixth code to one address in an hour is refused', r);
}
// ---- a ready-made video about the site itself (kind 'promo', Marty 2026-11-21): the email must not say the sender made it ----
{
const own = SI.compose(SI.SITES.videoappincome, 'ann', 'd01', L('d01'), ''), pro = SI.compose(SI.SITES.videoappincome, 'ann', 'd01', L('d01'), '', 'promo');
ok(own.subject === 'ann made you a video' && own.text.includes("Here's one I made: " + L('d01')), 'their own video keeps the approved wording');
ok(pro.subject === 'ann sent you a video' && pro.text.includes("Here's a short video that shows how it works: " + L('d01')) && !/I made|made you/.test(pro.text + pro.subject), 'a ready-made video is never called the sender\'s own');
ok(pro.html.includes('href="' + L('d01') + '"'), 'the link is clickable in the ready-made version');
const strip = t => t.replace("Here's a short video that shows how it works: ", "Here's one I made: ");
ok(strip(pro.text) === own.text, 'every other word of the email is the same');
const n = sent.length, r = await SI.handle('send', { rid: 'rid-promo-000001', site: 'videoappincome', sender: { email: 'bob@mail.test' }, kind: 'promo', items: [{ username: 'carl', link: L('carl') }] });
if (r.ok && r.sent === 1) ok(sent.length === n + 1 && sent[n][1] === 'bob sent you a video' && /shows how it works/.test(sent[n][2]), 'the send call passes the kind through to the email', sent[n] && sent[n][1]);
else ok(false, 'promo send through the full path', r);
}
fs.rmSync(dir, { recursive: true, force: true });
console.log('\n' + passes + ' passed, ' + fails + ' failed'); process.exit(fails ? 1 : 0);