diff options
author | Thomas Citharel <tcit@tcit.fr> | 2020-03-08 17:33:27 +0100 |
---|---|---|
committer | Thomas Citharel <tcit@tcit.fr> | 2020-04-13 15:07:42 +0200 |
commit | ebdf66b70619a30fd3f9172c1b725b8f56ea9358 (patch) | |
tree | 2e81468128e1ff9a6fe599255b153563507816a2 /apps/dav/lib/AppInfo/Application.php | |
parent | 21d8a2bfc16bef4b813d316b18768947e5416ff8 (diff) | |
download | nextcloud-server-ebdf66b70619a30fd3f9172c1b725b8f56ea9358.tar.gz nextcloud-server-ebdf66b70619a30fd3f9172c1b725b8f56ea9358.zip |
Provide dav setting for user's default calendar
And add tests to handle schedule-default-calendar-URL
Signed-off-by: Thomas Citharel <tcit@tcit.fr>
Diffstat (limited to 'apps/dav/lib/AppInfo/Application.php')
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 29c77cad07f..c22afa755cb 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -49,6 +49,7 @@ use OCA\DAV\HookManager; use OCP\AppFramework\App; use OCP\Calendar\IManager as ICalendarManager; use OCP\Contacts\IManager as IContactsManager; +use OCP\IConfig; use OCP\IUser; use Symfony\Component\EventDispatcher\GenericEvent; @@ -244,6 +245,19 @@ class Application extends App { $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', $listener); $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', $listener); $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', $listener); + + /** + * In case the user has set their default calendar to this one + */ + $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendar', function (GenericEvent $event) { + /** @var IConfig $config */ + $config = $this->getContainer()->getServer()->getConfig(); + $principalUri = $event->getArgument('calendarData')['principaluri']; + if (strpos($principalUri, 'principals/users') === 0) { + list(, $UID) = \Sabre\Uri\split($principalUri); + $config->deleteUserValue($UID, 'dav', 'defaultCalendar'); + } + }); } public function getSyncService() { |