Admin members: resolve sponsors against every account, not the page's 500
The Members page loads the newest 500 accounts and built its sponsor name lookup from that same list. Once the site passed 500 accounts every sponsor who joined before that window became unfindable, so the page labelled them "dead link: <name>" with a tooltip saying the member would fall into the holding tank. It was doing that to 144 of the 500 rows, including cryptoassets 76 times, and not one token on the whole site is genuinely unresolvable. Sponsorship itself was never affected: assignment at purchase time looks each token up directly rather than scanning a list. accounts.identities() returns the identity columns for every account with no limit, which stays cheap at any size, and the page uses that for the lookup while still showing 500 rows. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -2998,8 +2998,10 @@ const server = http.createServer(async (req, res) => {
|
||||
if (!isAdmin(req)) return json(res, 401, { error: 'auth' });
|
||||
const members = await accounts.listAll(500);
|
||||
// resolve each sponsor token (username, share code or member #) to the sponsor's name
|
||||
// the lookup covers EVERY account, not the page's slice: built from `members` it called every
|
||||
// sponsor who joined before the newest 500 a dead link (144 of them, Marty 2026-09-23)
|
||||
const byTok = {};
|
||||
for (const m of members) for (const t of [m.username, m.code, m.memberId ? String(m.memberId) : null]) if (t) byTok[String(t).toLowerCase()] = m;
|
||||
for (const m of await accounts.identities()) for (const t of [m.username, m.code, m.memberId ? String(m.memberId) : null]) if (t) byTok[String(t).toLowerCase()] = m;
|
||||
for (const m of members) {
|
||||
const t = String(m.sponsorRef || '').toLowerCase();
|
||||
const sp = t ? byTok[t] : null;
|
||||
|
||||
Reference in New Issue
Block a user