From 13f57e073e79c23e3d06fdaf9abf326190e4a321 Mon Sep 17 00:00:00 2001 From: Carl Schwan Date: Mon, 4 May 2026 12:48:10 +0200 Subject: [PATCH] fix: Dispatch old comment events Signed-off-by: Carl Schwan --- .../comments/lib/Listener/CommentsEventListener.php | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/apps/comments/lib/Listener/CommentsEventListener.php b/apps/comments/lib/Listener/CommentsEventListener.php index 55a1190ea11..61593d81107 100644 --- a/apps/comments/lib/Listener/CommentsEventListener.php +++ b/apps/comments/lib/Listener/CommentsEventListener.php @@ -13,7 +13,12 @@ namespace OCA\Comments\Listener; use OCA\Comments\Activity\Listener as ActivityListener; use OCA\Comments\Notification\Listener as NotificationListener; use OCP\Comments\CommentsEvent; +use OCP\Comments\Events\BeforeCommentUpdatedEvent; +use OCP\Comments\Events\CommentAddedEvent; +use OCP\Comments\Events\CommentDeletedEvent; +use OCP\Comments\Events\CommentUpdatedEvent; use OCP\EventDispatcher\Event; +use OCP\EventDispatcher\IEventDispatcher; use OCP\EventDispatcher\IEventListener; /** @template-implements IEventListener */ @@ -21,6 +26,7 @@ class CommentsEventListener implements IEventListener { public function __construct( private ActivityListener $activityListener, private NotificationListener $notificationListener, + private IEventDispatcher $eventDispatcher, ) { } @@ -29,6 +35,13 @@ class CommentsEventListener implements IEventListener { return; } + if ($event instanceof CommentAddedEvent + || $event instanceof CommentUpdatedEvent + || $event instanceof CommentDeletedEvent + || $event instanceof BeforeCommentUpdatedEvent) { + $this->eventDispatcher->dispatchTyped(new CommentsEvent($event->getEvent(), $event->getComment())); + } + if ($event->getComment()->getObjectType() !== 'files') { // this is a 'files'-specific Handler return;