fix(comments): register event listener for typed comment events

Since the typed comment events (CommentAddedEvent, CommentUpdatedEvent,
etc.) were introduced in NC34, dispatchTyped() dispatches using the exact
subclass name. Registering only for CommentsEvent::class means the listener
never fires, so comment mention notifications are never created or cleared.

AI-Assisted-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Signed-off-by: Anna Larch <anna@nextcloud.com>
This commit is contained in:
Anna Larch 2026-04-25 10:15:26 +02:00
parent 354c641bd4
commit 97008755dd

View file

@ -23,7 +23,10 @@ use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Comments\CommentsEntityEvent;
use OCP\Comments\CommentsEvent;
use OCP\Comments\Events\BeforeCommentUpdatedEvent;
use OCP\Comments\Events\CommentAddedEvent;
use OCP\Comments\Events\CommentDeletedEvent;
use OCP\Comments\Events\CommentUpdatedEvent;
class Application extends App implements IBootstrap {
public const APP_ID = 'comments';
@ -48,7 +51,19 @@ class Application extends App implements IBootstrap {
CommentsEntityEventListener::class
);
$context->registerEventListener(
CommentsEvent::class,
CommentAddedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
BeforeCommentUpdatedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
CommentUpdatedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
CommentDeletedEvent::class,
CommentsEventListener::class,
);