Fix the inert peering admin menu (#131) #132

Merged
Cordy merged 1 commit from fix/peering-menu-inert into main 2026-08-07 00:31:25 +00:00
Owner

Two lines, both in web/static/index.html.

1. The reported bug — a ReferenceError from a false guard. The handler was () => { closeUserMenu && closeUserMenu(); openPeeringDialog(); }. closeUserMenu is undeclared anywhere; && does not protect against an undeclared identifier (only against a declared-falsy one), so the arrow function threw ReferenceError on its first token and openPeeringDialog() never ran. Now uses closeMenus(), the function every sibling handler uses.

2. Wrong visibility gate. Was !feat.lic — peering is an admin surface and is free-tier, so a free-tier admin was denied the button and a licensed non-admin was shown one that 403s. Now !(me && me.admin), mirroring um-settings.

Verified: closeUserMenu no longer appears anywhere; both inline <script> blocks pass node --check.

Not visually confirmed, and a caveat for the dogfood

Same limit as #105 — structure and syntax are checked, layout is not. And the dogfood has no peering.statePath set, so PeeringAPI is nil server-side: after this fix the dialog will open but peerRefresh will 404 because the peering subsystem isn't enabled. That is expected until peering is configured (#106 territory). The design choice of whether to hide the button entirely until peering is enabled (a boot probe, option B on the issue) is left for Nikola; this PR ships the correct-for-configured behaviour.

Two lines, both in `web/static/index.html`. **1. The reported bug — a `ReferenceError` from a false guard.** The handler was `() => { closeUserMenu && closeUserMenu(); openPeeringDialog(); }`. `closeUserMenu` is undeclared anywhere; `&&` does not protect against an undeclared identifier (only against a declared-falsy one), so the arrow function threw `ReferenceError` on its first token and `openPeeringDialog()` never ran. Now uses `closeMenus()`, the function every sibling handler uses. **2. Wrong visibility gate.** Was `!feat.lic` — peering is an admin surface and is free-tier, so a free-tier admin was denied the button and a licensed non-admin was shown one that 403s. Now `!(me && me.admin)`, mirroring `um-settings`. Verified: `closeUserMenu` no longer appears anywhere; both inline `<script>` blocks pass `node --check`. ## Not visually confirmed, and a caveat for the dogfood Same limit as #105 — structure and syntax are checked, layout is not. And the dogfood has no `peering.statePath` set, so `PeeringAPI` is nil server-side: after this fix the dialog will **open** but `peerRefresh` will 404 because the peering subsystem isn't enabled. That is expected until peering is configured (#106 territory). The design choice of whether to hide the button entirely until peering is enabled (a boot probe, option B on the issue) is left for Nikola; this PR ships the correct-for-configured behaviour.
fix(ui): peering admin menu was inert — closeUserMenu ReferenceError, wrong gate (#131)
All checks were successful
ci / test-and-build (pull_request) Successful in 33s
76cb36d76c
Cordy merged commit a333e4ceab into main 2026-08-07 00:31:25 +00:00
Cordy deleted branch fix/peering-menu-inert 2026-08-07 00:31:28 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: Cordy/Cairn#132
No description provided.