From 6d0ae8dfb5ad865879231f562066f9565c14d32f Mon Sep 17 00:00:00 2001 From: Oren Date: Sun, 25 Oct 2026 23:15:38 -0400 Subject: [PATCH] fix(frontend): hide news widget from default dashboard for non-superusers (#13099) defaultLayouts only places the news widget for superusers, but defaultWidgets always included it, so non-superusers saw a "Requires Superuser" alert on a fresh dashboard. --- src/frontend/src/components/dashboard/DashboardLayout.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/frontend/src/components/dashboard/DashboardLayout.tsx b/src/frontend/src/components/dashboard/DashboardLayout.tsx index 0278bc60f8..446866a3fb 100644 --- a/src/frontend/src/components/dashboard/DashboardLayout.tsx +++ b/src/frontend/src/components/dashboard/DashboardLayout.tsx @@ -263,14 +263,16 @@ export default function DashboardLayout() { lg: layouts }; }, [user]); - const loadWigs = ['news', 'gstart']; const defaultWidgets = useMemo(() => { + // Only superusers can view the "news" widget (matches defaultLayouts) + const loadWigs = user.isSuperuser() ? ['news', 'gstart'] : ['gstart']; + return loadWigs .map((lwid: string) => availableWidgets.items.find((wid) => wid.label === lwid) ) .filter((widget): widget is DashboardWidgetProps => widget !== undefined); - }, [availableWidgets.items, defaultLayouts]); + }, [availableWidgets.items, defaultLayouts, user]); return ( <>