diff options
author | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-05-07 17:09:37 +0200 |
---|---|---|
committer | Christoph Wurst <christoph@winzerhof-wurst.at> | 2021-05-07 17:09:37 +0200 |
commit | cebe951b8ecd1586b5fae4e0e7f6307679e36f51 (patch) | |
tree | 4af572c691fd066a9b8986dddd8bfb31c4ee2928 /apps/dav/lib | |
parent | 884e34b12a90f8958ac46e0b8c135d61c3895cd5 (diff) | |
download | nextcloud-server-cebe951b8ecd1586b5fae4e0e7f6307679e36f51.tar.gz nextcloud-server-cebe951b8ecd1586b5fae4e0e7f6307679e36f51.zip |
Remove the untyped calendar update event
Signed-off-by: Christoph Wurst <christoph@winzerhof-wurst.at>
Diffstat (limited to 'apps/dav/lib')
-rw-r--r-- | apps/dav/lib/AppInfo/Application.php | 11 | ||||
-rw-r--r-- | apps/dav/lib/CalDAV/CalDavBackend.php | 8 | ||||
-rw-r--r-- | apps/dav/lib/Listener/ActivityUpdaterListener.php | 20 |
3 files changed, 21 insertions, 18 deletions
diff --git a/apps/dav/lib/AppInfo/Application.php b/apps/dav/lib/AppInfo/Application.php index 4c410697d2e..8c1e4f77a12 100644 --- a/apps/dav/lib/AppInfo/Application.php +++ b/apps/dav/lib/AppInfo/Application.php @@ -57,6 +57,7 @@ use OCA\DAV\Events\CalendarObjectCreatedEvent; use OCA\DAV\Events\CalendarObjectDeletedEvent; use OCA\DAV\Events\CalendarObjectUpdatedEvent; use OCA\DAV\Events\CalendarShareUpdatedEvent; +use OCA\DAV\Events\CalendarUpdatedEvent; use OCA\DAV\HookManager; use OCA\DAV\Listener\ActivityUpdaterListener; use OCA\DAV\Listener\CalendarContactInteractionListener; @@ -119,6 +120,7 @@ class Application extends App implements IBootstrap { $context->registerEventListener(CalendarDeletedEvent::class, ActivityUpdaterListener::class); $context->registerEventListener(CalendarDeletedEvent::class, CalendarObjectReminderUpdaterListener::class); $context->registerEventListener(CalendarDeletedEvent::class, CalendarDeletionDefaultUpdaterListener::class); + $context->registerEventListener(CalendarUpdatedEvent::class, ActivityUpdaterListener::class); $context->registerEventListener(CalendarObjectCreatedEvent::class, ActivityUpdaterListener::class); $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarContactInteractionListener::class); $context->registerEventListener(CalendarObjectCreatedEvent::class, CalendarObjectReminderUpdaterListener::class); @@ -200,15 +202,6 @@ class Application extends App implements IBootstrap { $syncService->updateUser($user); }); - $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', function (GenericEvent $event) use ($container) { - /** @var Backend $backend */ - $backend = $container->query(Backend::class); - $backend->onCalendarUpdate( - $event->getArgument('calendarData'), - $event->getArgument('shares'), - $event->getArgument('propertyMutations') - ); - }); $dispatcher->addListener('\OCA\DAV\CalDAV\CalDavBackend::updateShares', function (GenericEvent $event) use ($container) { /** @var Backend $backend */ $backend = $container->query(Backend::class); diff --git a/apps/dav/lib/CalDAV/CalDavBackend.php b/apps/dav/lib/CalDAV/CalDavBackend.php index 69924e62154..2daa03843de 100644 --- a/apps/dav/lib/CalDAV/CalDavBackend.php +++ b/apps/dav/lib/CalDAV/CalDavBackend.php @@ -861,14 +861,6 @@ class CalDavBackend extends AbstractBackend implements SyncSupport, Subscription $calendarData = $this->getCalendarById($calendarId); $shares = $this->getShares($calendarId); $this->dispatcher->dispatchTyped(new CalendarUpdatedEvent((int)$calendarId, $calendarData, $shares, $mutations)); - $this->legacyDispatcher->dispatch('\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', new GenericEvent( - '\OCA\DAV\CalDAV\CalDavBackend::updateCalendar', - [ - 'calendarId' => $calendarId, - 'calendarData' => $calendarData, - 'shares' => $shares, - 'propertyMutations' => $mutations, - ])); return true; }); diff --git a/apps/dav/lib/Listener/ActivityUpdaterListener.php b/apps/dav/lib/Listener/ActivityUpdaterListener.php index bd59108b4a1..30e0008b183 100644 --- a/apps/dav/lib/Listener/ActivityUpdaterListener.php +++ b/apps/dav/lib/Listener/ActivityUpdaterListener.php @@ -31,6 +31,7 @@ use OCA\DAV\Events\CalendarDeletedEvent; use OCA\DAV\Events\CalendarObjectCreatedEvent; use OCA\DAV\Events\CalendarObjectDeletedEvent; use OCA\DAV\Events\CalendarObjectUpdatedEvent; +use OCA\DAV\Events\CalendarUpdatedEvent; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; use Psr\Log\LoggerInterface; @@ -67,7 +68,24 @@ class ActivityUpdaterListener implements IEventListener { 'exception' => $e, ]); } - } else if ($event instanceof CalendarDeletedEvent) { + } elseif ($event instanceof CalendarUpdatedEvent) { + try { + $this->activityBackend->onCalendarUpdate( + $event->getCalendarData(), + $event->getShares(), + $event->getMutations() + ); + + $this->logger->debug( + sprintf('Activity generated for changed calendar %d', $event->getCalendarId()) + ); + } catch (Throwable $e) { + // Any error with activities shouldn't abort the calendar update, so we just log it + $this->logger->error('Error generating activities for changed calendar: ' . $e->getMessage(), [ + 'exception' => $e, + ]); + } + } elseif ($event instanceof CalendarDeletedEvent) { try { $this->activityBackend->onCalendarDelete( $event->getCalendarData(), |