From 0408c37b3de77fd351c1a2fa91f74e47fc7e6cd6 Mon Sep 17 00:00:00 2001 From: Thomas Citharel Date: Sun, 5 Apr 2020 20:57:26 +0200 Subject: [PATCH] Only delete the default calendar setting when the default calendar itself is deleted Signed-off-by: Thomas Citharel --- apps/dav/lib/AppInfo/Application.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index c22afa755c..d5e3358d96 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -255,7 +255,10 @@ class Application extends App { $principalUri = $event->getArgument('calendarData')['principaluri']; if (strpos($principalUri, 'principals/users') === 0) { list(, $UID) = \Sabre\Uri\split($principalUri); - $config->deleteUserValue($UID, 'dav', 'defaultCalendar'); + $uri = $event->getArgument('calendarData')['uri']; + if ($config->getUserValue($UID, 'dav', 'defaultCalendar') === $uri) { + $config->deleteUserValue($UID, 'dav', 'defaultCalendar'); + } } }); }