From ffcb24824f6b4afacb4e36147eb3b701b99441db Mon Sep 17 00:00:00 2001 From: Classic298 <27028174+Classic298@users.noreply.github.com> Date: Wed, 21 Oct 2026 19:13:22 +0200 Subject: [PATCH] fix: Calendar page opens empty with an error when Calendar is turned off (#32837) With Calendar switched off by an admin, or the calendar permission taken away, the sidebar entry was hidden but opening /calendar directly from a bookmark or the address bar still showed an empty month grid with a "401 Unauthorized" error. The page now sends these users to the home page, the same as Notes and Automations do. Fixes #32834 --- src/routes/(app)/calendar/+page.svelte | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/routes/(app)/calendar/+page.svelte b/src/routes/(app)/calendar/+page.svelte index 5e8da41b1a..f09fe3535d 100644 --- a/src/routes/(app)/calendar/+page.svelte +++ b/src/routes/(app)/calendar/+page.svelte @@ -2,7 +2,7 @@ import { onMount, getContext, tick } from 'svelte'; import { toast } from 'svelte-sonner'; import { goto } from '$app/navigation'; - import { WEBUI_NAME, mobile, showSidebar, user } from '$lib/stores'; + import { WEBUI_NAME, config, mobile, showSidebar, user } from '$lib/stores'; import { getCalendars, getCalendarEvents, @@ -202,6 +202,14 @@ : `${MONTH_NAMES[currentDate.getMonth()]} ${currentDate.getFullYear()}`; onMount(async () => { + if ( + !$config?.features?.enable_calendar || + ($user?.role !== 'admin' && !$user?.permissions?.features?.calendar) + ) { + goto('/'); + return; + } + await loadCalendars(); await refresh(); loaded = true;