diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-03-12 11:20:04 +0100 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-05-31 07:49:19 +0200 |
commit | d6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f (patch) | |
tree | 942254503672d6ab3e0b6c8fca0bd4053db352b9 /apps/dav/lib/CalDAV/Calendar.php | |
parent | 9e596dd0cf455dc1639141c695f89c7d936f4c0c (diff) | |
download | nextcloud-server-d6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f.tar.gz nextcloud-server-d6d8e9215c69a9e8d4bfa2035c657b0a037f3a2f.zip |
Add a trashbin for calendars and calendar objects
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib/CalDAV/Calendar.php')
-rw-r--r-- | apps/dav/lib/CalDAV/Calendar.php | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/apps/dav/lib/CalDAV/Calendar.php b/apps/dav/lib/CalDAV/Calendar.php index abddf2b706f..191ac384e72 100644 --- a/apps/dav/lib/CalDAV/Calendar.php +++ b/apps/dav/lib/CalDAV/Calendar.php @@ -42,9 +42,9 @@ use Sabre\DAV\PropPatch; * Class Calendar * * @package OCA\DAV\CalDAV - * @property BackendInterface|CalDavBackend $caldavBackend + * @property CalDavBackend $caldavBackend */ -class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { +class Calendar extends \Sabre\CalDAV\Calendar implements IRestorable, IShareable { /** @var IConfig */ private $config; @@ -52,6 +52,9 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { /** @var IL10N */ protected $l10n; + /** @var bool */ + private $useTrashbin = true; + /** * Calendar constructor. * @@ -269,7 +272,10 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { $this->config->setUserValue($userId, 'dav', 'generateBirthdayCalendar', 'no'); } - parent::delete(); + $this->caldavBackend->deleteCalendar( + $this->calendarInfo['id'], + !$this->useTrashbin + ); } public function propPatch(PropPatch $propPatch) { @@ -399,4 +405,12 @@ class Calendar extends \Sabre\CalDAV\Calendar implements IShareable { return parent::getChanges($syncToken, $syncLevel, $limit); } + + public function restore(): void { + $this->caldavBackend->restoreCalendar((int) $this->calendarInfo['id']); + } + + public function disableTrashbin(): void { + $this->useTrashbin = false; + } } |