From 9071634606b039847013a1f26c157720fc55b44e Mon Sep 17 00:00:00 2001 From: Louis King Date: Tue, 16 Jun 2026 22:02:59 +0100 Subject: [PATCH] fix: normalize packets feature flag check to !== false The packets feature was the only flag gated with a strict `=== true` check in the SPA JavaScript while every other flag uses `!== false`. Align packets to the shared pattern across route registration, mobile nav, page titles, the home nav card, and the messages/advertisements packet-detail link gates. --- src/meshcore_hub/web/static/js/spa/app.js | 6 +++--- src/meshcore_hub/web/static/js/spa/pages/advertisements.js | 2 +- src/meshcore_hub/web/static/js/spa/pages/home.js | 2 +- src/meshcore_hub/web/static/js/spa/pages/messages.js | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/meshcore_hub/web/static/js/spa/app.js b/src/meshcore_hub/web/static/js/spa/app.js index e4a54ab..15713d2 100644 --- a/src/meshcore_hub/web/static/js/spa/app.js +++ b/src/meshcore_hub/web/static/js/spa/app.js @@ -96,7 +96,7 @@ if (features.messages !== false) { if (features.advertisements !== false) { router.addRoute('/advertisements', pageHandler(pages.advertisements)); } -if (features.packets === true) { +if (features.packets !== false) { router.addRoute('/packets', pageHandler(pages.packets)); router.addRoute('/packets/hash/:hash', pageHandler(pages.packetGroupDetail)); router.addRoute('/packets/:id', pageHandler(pages.packetDetail)); @@ -178,7 +178,7 @@ function updatePageTitle(pathname) { if (features.channels !== false) titles['/channels'] = composePageTitle('entities.channels'); if (features.messages !== false) titles['/messages'] = composePageTitle('entities.messages'); if (features.advertisements !== false) titles['/advertisements'] = composePageTitle('entities.advertisements'); - if (features.packets === true) titles['/packets'] = composePageTitle('entities.packets'); + if (features.packets !== false) titles['/packets'] = composePageTitle('entities.packets'); if (features.map !== false) titles['/map'] = composePageTitle('entities.map'); if (features.members !== false) titles['/members'] = composePageTitle('entities.members'); titles['/profile'] = composePageTitle('links.profile'); @@ -232,7 +232,7 @@ function renderMobileNav(config) { if (features.messages !== false) { items.push(html`
  • ${iconMessages('h-5 w-5 nav-icon-messages')} ${t('entities.messages')}
  • `); } - if (features.packets === true) { + if (features.packets !== false) { items.push(html`
  • ${iconPackets('h-5 w-5 nav-icon-packets')} ${t('entities.packets')}
  • `); } if (features.map !== false) { diff --git a/src/meshcore_hub/web/static/js/spa/pages/advertisements.js b/src/meshcore_hub/web/static/js/spa/pages/advertisements.js index 5ab45be..e910273 100644 --- a/src/meshcore_hub/web/static/js/spa/pages/advertisements.js +++ b/src/meshcore_hub/web/static/js/spa/pages/advertisements.js @@ -39,7 +39,7 @@ export async function render(container, params, router) { const config = getConfig(); const features = config.features || {}; - const packetsEnabled = features.packets === true; + const packetsEnabled = features.packets !== false; const tz = config.timezone || ''; const tzBadge = tz && tz !== 'UTC' ? html`${tz}` : nothing; const navigate = (url) => router.navigate(url); diff --git a/src/meshcore_hub/web/static/js/spa/pages/home.js b/src/meshcore_hub/web/static/js/spa/pages/home.js index 1b8addb..4f1e17a 100644 --- a/src/meshcore_hub/web/static/js/spa/pages/home.js +++ b/src/meshcore_hub/web/static/js/spa/pages/home.js @@ -105,7 +105,7 @@ function renderHeroSection({ networkName, logoUrl, logoInvertLight, networkCity, label: t('entities.messages'), colorVar: '--color-messages', }) : nothing} - ${features.packets === true ? renderNavCard({ + ${features.packets !== false ? renderNavCard({ href: '/packets', icon: iconPackets('w-full h-full'), label: t('entities.packets'), diff --git a/src/meshcore_hub/web/static/js/spa/pages/messages.js b/src/meshcore_hub/web/static/js/spa/pages/messages.js index 884f456..e7c7ca9 100644 --- a/src/meshcore_hub/web/static/js/spa/pages/messages.js +++ b/src/meshcore_hub/web/static/js/spa/pages/messages.js @@ -26,7 +26,7 @@ export async function render(container, params, router) { const config = getConfig(); const features = config.features || {}; - const packetsEnabled = features.packets === true; + const packetsEnabled = features.packets !== false; let channelLabels = new Map(); const tz = config.timezone || ''; const tzBadge = tz && tz !== 'UTC' ? html`${tz}` : nothing;