From 8a647ad1a8d92ee1b69352588559c12bcab4b158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20Tollk=C3=BChn?= Date: Wed, 7 Oct 2026 22:05:57 +0200 Subject: [PATCH] use Personal calendar instead of first writeable calendar --- lib/Controller/CalendarController.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/lib/Controller/CalendarController.php b/lib/Controller/CalendarController.php index 1cd64e4..168e9e1 100644 --- a/lib/Controller/CalendarController.php +++ b/lib/Controller/CalendarController.php @@ -16,6 +16,11 @@ use OCP\IUserSession; class CalendarController extends Controller { + /* + * Target calendar for created events. + */ + private const CALENDAR_NAME = 'Personal'; + /* * datetime-local format as sent by jitsi-launch, * e.g. "2026-10-07T14:15". @@ -116,7 +121,9 @@ class CalendarController extends Controller if ($calendar === null) { throw new \RuntimeException( - 'No writable calendar is available for this user.' + 'No writable calendar named "' + . self::CALENDAR_NAME + . '" is available for this user.' ); } @@ -133,7 +140,7 @@ class CalendarController extends Controller } /** - * First writable calendar of the user. + * The user's "Personal" calendar. * * getCalendarsForUser() returns ICalendar objects. * Only calendars implementing ICreateFromString are writable. @@ -143,7 +150,11 @@ class CalendarController extends Controller $calendars = $this->calendarManager->getCalendarsForUser($userId); foreach ($calendars as $calendar) { - if ($calendar instanceof ICreateFromString) { + if (!$calendar instanceof ICreateFromString) { + continue; + } + + if ($calendar->getDisplayName() === self::CALENDAR_NAME) { return $calendar; } }