Fix referral attribution (username joins) + broadcast rate-limit regression
- Dashboard "Your line" roster now matches referrals joined under the member's
USERNAME link (invite link is /join/<username>), not just code + member id —
username joins were invisible.
- lastBroadcastAt now counts only kind='broadcast'. Chat rides the same table,
so chatting had been tripping the once-a-day broadcast limit ("try again in
24h" on the first broadcast).
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+2
-2
@@ -19,11 +19,11 @@ const DAY = 86400000;
|
||||
async function lastBroadcastAt(fromEmail) {
|
||||
const e = String(fromEmail || '').toLowerCase();
|
||||
if (db.enabled()) {
|
||||
const r = await db.q('SELECT MAX(sent) m FROM sponsor_messages WHERE from_email=?', [e]);
|
||||
const r = await db.q("SELECT MAX(sent) m FROM sponsor_messages WHERE from_email=? AND kind='broadcast'", [e]);
|
||||
return r.length && r[0].m ? Number(r[0].m) : 0;
|
||||
}
|
||||
if (!J.db) J.load();
|
||||
const mine = J.db.items.filter(i => i.fromEmail === e).map(i => i.sent);
|
||||
const mine = J.db.items.filter(i => i.fromEmail === e && (i.kind || 'broadcast') === 'broadcast').map(i => i.sent);
|
||||
return mine.length ? Math.max(...mine) : 0;
|
||||
}
|
||||
// deliver one message to many recipients (already-resolved emails). Returns count.
|
||||
|
||||
Reference in New Issue
Block a user