summaryrefslogtreecommitdiffstats
path: root/apps/dav/lib/CalDAV
diff options
context:
space:
mode:
authorChristoph Wurst <ChristophWurst@users.noreply.github.com>2021-05-07 16:47:44 +0200
committerGitHub <noreply@github.com>2021-05-07 16:47:44 +0200
commitf8c519f5f0b52075c5b343233a5e48f9bc8cf3aa (patch)
tree6e780de6cf25cd57642e2929198f7bb7078a7839 /apps/dav/lib/CalDAV
parented2d6eee1e45a54167d628eb31fc12b0d019c0d5 (diff)
parentf5462650f1480bf23a58285e0e4476957a0720db (diff)
downloadnextcloud-server-f8c519f5f0b52075c5b343233a5e48f9bc8cf3aa.tar.gz
nextcloud-server-f8c519f5f0b52075c5b343233a5e48f9bc8cf3aa.zip
Merge pull request #26913 from nextcloud/chore/dav-calendar-object-untyped-events
Drop some more untyped events from the dav code
Diffstat (limited to 'apps/dav/lib/CalDAV')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php27
-rw-r--r--apps/dav/lib/CalDAV/Reminder/ReminderService.php38
2 files changed, 11 insertions, 54 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 138bb9b4828..e14c0ec6b45 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -1141,15 +1141,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
- $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject', new GenericEvent(
- '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject',
- [
- 'calendarId' => $calendarId,
- 'calendarData' => $calendarRow,
- 'shares' => $shares,
- 'objectData' => $objectRow,
- ]
- ));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
@@ -1215,15 +1206,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent((int)$calendarId, $calendarRow, $shares, $objectRow));
- $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject', new GenericEvent(
- '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject',
- [
- 'calendarId' => $calendarId,
- 'calendarData' => $calendarRow,
- 'shares' => $shares,
- 'objectData' => $objectRow,
- ]
- ));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
@@ -1278,15 +1260,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent((int)$calendarId, $calendarRow, $shares, $data));
- $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject', new GenericEvent(
- '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject',
- [
- 'calendarId' => $calendarId,
- 'calendarData' => $calendarRow,
- 'shares' => $shares,
- 'objectData' => $data,
- ]
- ));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
diff --git a/apps/dav/lib/CalDAV/Reminder/ReminderService.php b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
index 9c27231cb8a..83fe413c0ee 100644
--- a/apps/dav/lib/CalDAV/Reminder/ReminderService.php
+++ b/apps/dav/lib/CalDAV/Reminder/ReminderService.php
@@ -44,6 +44,7 @@ use Sabre\VObject\InvalidDataException;
use Sabre\VObject\ParseException;
use Sabre\VObject\Recur\EventIterator;
use Sabre\VObject\Recur\NoInstancesException;
+use function strcasecmp;
class ReminderService {
@@ -154,39 +155,15 @@ class ReminderService {
}
/**
- * @param string $action
* @param array $objectData
* @throws VObject\InvalidDataException
*/
- public function onTouchCalendarObject(string $action,
- array $objectData):void {
+ public function onCalendarObjectCreate(array $objectData):void {
// We only support VEvents for now
if (strcasecmp($objectData['component'], 'vevent') !== 0) {
return;
}
- switch ($action) {
- case '\OCA\DAV\CalDAV\CalDavBackend::createCalendarObject':
- $this->onCalendarObjectCreate($objectData);
- break;
-
- case '\OCA\DAV\CalDAV\CalDavBackend::updateCalendarObject':
- $this->onCalendarObjectEdit($objectData);
- break;
-
- case '\OCA\DAV\CalDAV\CalDavBackend::deleteCalendarObject':
- $this->onCalendarObjectDelete($objectData);
- break;
-
- default:
- break;
- }
- }
-
- /**
- * @param array $objectData
- */
- private function onCalendarObjectCreate(array $objectData):void {
$calendarData = is_resource($objectData['calendardata'])
? stream_get_contents($objectData['calendardata'])
: $objectData['calendardata'];
@@ -307,8 +284,9 @@ class ReminderService {
/**
* @param array $objectData
+ * @throws VObject\InvalidDataException
*/
- private function onCalendarObjectEdit(array $objectData):void {
+ public function onCalendarObjectEdit(array $objectData):void {
// TODO - this can be vastly improved
// - get cached reminders
// - ...
@@ -319,8 +297,14 @@ class ReminderService {
/**
* @param array $objectData
+ * @throws VObject\InvalidDataException
*/
- private function onCalendarObjectDelete(array $objectData):void {
+ public function onCalendarObjectDelete(array $objectData):void {
+ // We only support VEvents for now
+ if (strcasecmp($objectData['component'], 'vevent') !== 0) {
+ return;
+ }
+
$this->backend->cleanRemindersForEvent((int) $objectData['id']);
}