aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorEdward Ly <contact@edward.ly>2025-02-27 17:20:12 -0800
committerEdward Ly <contact@edward.ly>2025-03-07 08:09:53 -0800
commitdd181f4b2ad98fd75a6f1e90651d40363eb0f17c (patch)
tree76d36db2ce7cfdba20b9ede43ed03cb6d5d357ed /apps
parentbb6b4626908b00faf4c0a37417b0a22fb76a7ab2 (diff)
downloadnextcloud-server-dd181f4b2ad98fd75a6f1e90651d40363eb0f17c.tar.gz
nextcloud-server-dd181f4b2ad98fd75a6f1e90651d40363eb0f17c.zip
feat(dav): add webhook compatibility for calendar object events
Signed-off-by: Edward Ly <contact@edward.ly>
Diffstat (limited to 'apps')
-rw-r--r--apps/dav/lib/CalDAV/CalDavBackend.php26
1 files changed, 26 insertions, 0 deletions
diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php
index 0c8b52a7491..32a6427052d 100644
--- a/apps/dav/lib/CalDAV/CalDavBackend.php
+++ b/apps/dav/lib/CalDAV/CalDavBackend.php
@@ -34,6 +34,12 @@ use OCA\DAV\Events\SubscriptionCreatedEvent;
use OCA\DAV\Events\SubscriptionDeletedEvent;
use OCA\DAV\Events\SubscriptionUpdatedEvent;
use OCP\AppFramework\Db\TTransactional;
+use OCP\Calendar\Events\CalendarObjectCreatedEvent as PublicCalendarObjectCreatedEvent;
+use OCP\Calendar\Events\CalendarObjectDeletedEvent as PublicCalendarObjectDeletedEvent;
+use OCP\Calendar\Events\CalendarObjectMovedEvent as PublicCalendarObjectMovedEvent;
+use OCP\Calendar\Events\CalendarObjectMovedToTrashEvent as PublicCalendarObjectMovedToTrashEvent;
+use OCP\Calendar\Events\CalendarObjectRestoredEvent as PublicCalendarObjectRestoredEvent;
+use OCP\Calendar\Events\CalendarObjectUpdatedEvent as PublicCalendarObjectUpdatedEvent;
use OCP\Calendar\Exceptions\CalendarException;
use OCP\DB\Exception;
use OCP\DB\QueryBuilder\IQueryBuilder;
@@ -1318,6 +1324,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectCreatedEvent($calendarId, $calendarRow, $shares, $objectRow));
+ $this->dispatcher->dispatchTyped(new PublicCalendarObjectCreatedEvent($calendarId, $calendarRow, $shares, $objectRow));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
@@ -1378,6 +1385,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectUpdatedEvent($calendarId, $calendarRow, $shares, $objectRow));
+ $this->dispatcher->dispatchTyped(new PublicCalendarObjectUpdatedEvent($calendarId, $calendarRow, $shares, $objectRow));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
@@ -1439,6 +1447,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$targetShares = $this->getShares($targetCalendarId);
$sourceCalendarRow = $this->getCalendarById($sourceCalendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectMovedEvent($sourceCalendarId, $sourceCalendarRow, $targetCalendarId, $targetCalendarRow, $sourceShares, $targetShares, $object));
+ $this->dispatcher->dispatchTyped(new PublicCalendarObjectMovedEvent($sourceCalendarId, $sourceCalendarRow, $targetCalendarId, $targetCalendarRow, $sourceShares, $targetShares, $object));
}
return true;
}, $this->db);
@@ -1497,6 +1506,7 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$shares = $this->getShares($calendarId);
$this->dispatcher->dispatchTyped(new CalendarObjectDeletedEvent($calendarId, $calendarRow, $shares, $data));
+ $this->dispatcher->dispatchTyped(new PublicCalendarObjectDeletedEvent($calendarId, $calendarRow, $shares, $data));
} else {
$subscriptionRow = $this->getSubscriptionById($calendarId);
@@ -1546,6 +1556,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$data
)
);
+ $this->dispatcher->dispatchTyped(
+ new PublicCalendarObjectMovedToTrashEvent(
+ $calendarId,
+ $calendarData,
+ $this->getShares($calendarId),
+ $data
+ )
+ );
}
}
@@ -1605,6 +1623,14 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription
$row
)
);
+ $this->dispatcher->dispatchTyped(
+ new PublicCalendarObjectRestoredEvent(
+ (int)$objectData['calendarid'],
+ $calendarRow,
+ $this->getShares((int)$row['calendarid']),
+ $row
+ )
+ );
}, $this->db);
}