Fix Suite org check: teamRootId is a comma-separated list, Number() made it NaN so every member read as outside the org (Marty hit this as #21); parse all roots + orgRootId fallback. Nav dedupe on /suite. Adds suite-meter module (per-position monthly quotas by level)

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
martbost
2026-08-28 06:33:08 -05:00
parent 6f28e94abd
commit 35b3c07e74
3 changed files with 90 additions and 3 deletions
+6 -2
View File
@@ -648,8 +648,12 @@ async function handleApi(req,res,pathname){
}
if(!d||!d.registered)return json(res,404,{error:'Position not found.'});
const cfg=getConfig();
const root=Number(cfg.teamRootId||21);
const inOrg=Number(d.id)===root||(Array.isArray(d.uplineChain)&&d.uplineChain.map(Number).includes(root));
// teamRootId is a comma-separated LIST of team roots (e.g. "21,137,139").
// Number() on that yields NaN -> every member reads as outside the org,
// which is exactly the bug Marty hit signing in as #21. Parse the list.
const roots=String(cfg.teamRootId||cfg.orgRootId||'21').split(',').map(x=>Number(x.trim())).filter(Boolean);
const chainIds=Array.isArray(d.uplineChain)?d.uplineChain.map(Number):[];
const inOrg=roots.some(r=>Number(d.id)===r||chainIds.includes(r));
// Team-beta gate: while suiteAllowlist is set (comma-separated ids),
// only those positions light up; everyone else sees the beta notice.
// Clearing the allowlist opens the Suite to the whole org - no deploy.