From 8ba2f27af24908926b2f5f69b4babc2e18bb1bca Mon Sep 17 00:00:00 2001
From: Linus Rath <139418639+rathlinus@users.noreply.github.com>
Date: Sat, 31 Oct 2026 15:25:37 +0100
Subject: [PATCH] feat: hide calendar tasks in settings when the organisation
turns them off
---
src/components/settings/CalendarSettings.tsx | 28 ++++++++++++-------
.../__tests__/org-policy-settings.test.ts | 8 ++++++
2 files changed, 26 insertions(+), 10 deletions(-)
diff --git a/src/components/settings/CalendarSettings.tsx b/src/components/settings/CalendarSettings.tsx
index 5d575c54..592db790 100644
--- a/src/components/settings/CalendarSettings.tsx
+++ b/src/components/settings/CalendarSettings.tsx
@@ -7,6 +7,7 @@ import {
type TimeFormat,
} from '../../stores/settings-store';
import { useLocaleStore } from '../../stores/locale-store';
+import { usePolicyFeature, useSettingLocked } from '../../stores/policy-store';
import { AUTO_TIME_ZONE, getDeviceTimeZone, isValidTimeZone } from '../../lib/calendar-timezone';
import { deviceSyncAvailable } from '../../device-sync/app/available';
import { CALENDAR_AUTHORITY } from '../../device-sync/types';
@@ -49,6 +50,10 @@ export function CalendarSettings() {
const birthdayCal = useSettingsStore((s) => s.showBirthdayCalendar);
const tasksEnabled = useSettingsStore((s) => s.enableCalendarTasks);
const showTasksOnCal = useSettingsStore((s) => s.showTasksOnCalendar);
+ // An organisation can turn tasks off: the option goes, as in the webmail
+ // (calendar-settings.tsx), and the policy pins it off.
+ const tasksAllowed = usePolicyFeature('calendarTasksEnabled');
+ const tasksLocked = useSettingLocked('enableCalendarTasks');
// Android with the native module only (#34).
const deviceSync = React.useMemo(() => deviceSyncAvailable(), []);
@@ -185,17 +190,20 @@ export function CalendarSettings() {
/>
-
- update('enableCalendarTasks', v)}
- />
-
+ {tasksAllowed && (
+
+ update('enableCalendarTasks', v)}
+ />
+
+ )}
- {tasksEnabled && (
+ {tasksAllowed && tasksEnabled && (
{
expect(page).toContain('disabled={themeLocked}');
expect(page).toContain("{themeLocked && (");
});
+
+ it('hides the tasks option when the organisation turns tasks off, and marks it locked', () => {
+ const page = settings('CalendarSettings');
+ expect(page).toContain("const tasksAllowed = usePolicyFeature('calendarTasksEnabled');");
+ expect(page).toContain("const tasksLocked = useSettingLocked('enableCalendarTasks');");
+ expect(page).toMatch(/\{tasksAllowed && \(\s*