nextcloud/apps/comments/lib/AppInfo/Application.php
Anna Larch 3bef50d012 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>
2026-05-05 09:21:40 +01:00

77 lines
2.3 KiB
PHP

<?php
/**
* SPDX-FileCopyrightText: 2016 Nextcloud GmbH and Nextcloud contributors
* SPDX-License-Identifier: AGPL-3.0-or-later
*/
namespace OCA\Comments\AppInfo;
use OCA\Comments\Capabilities;
use OCA\Comments\Listener\CommentsEntityEventListener;
use OCA\Comments\Listener\CommentsEventListener;
use OCA\Comments\Listener\LoadAdditionalScripts;
use OCA\Comments\Listener\LoadSidebarScripts;
use OCA\Comments\MaxAutoCompleteResultsInitialState;
use OCA\Comments\Notification\Notifier;
use OCA\Comments\Search\CommentsSearchProvider;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
use OCA\Files\Event\LoadSidebar;
use OCP\AppFramework\App;
use OCP\AppFramework\Bootstrap\IBootContext;
use OCP\AppFramework\Bootstrap\IBootstrap;
use OCP\AppFramework\Bootstrap\IRegistrationContext;
use OCP\Comments\CommentsEntityEvent;
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';
public function __construct(array $urlParams = []) {
parent::__construct(self::APP_ID, $urlParams);
}
public function register(IRegistrationContext $context): void {
$context->registerCapability(Capabilities::class);
$context->registerEventListener(
LoadAdditionalScriptsEvent::class,
LoadAdditionalScripts::class
);
$context->registerEventListener(
LoadSidebar::class,
LoadSidebarScripts::class
);
$context->registerEventListener(
CommentsEntityEvent::class,
CommentsEntityEventListener::class
);
$context->registerEventListener(
CommentAddedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
BeforeCommentUpdatedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
CommentUpdatedEvent::class,
CommentsEventListener::class,
);
$context->registerEventListener(
CommentDeletedEvent::class,
CommentsEventListener::class,
);
$context->registerSearchProvider(CommentsSearchProvider::class);
$context->registerInitialStateProvider(MaxAutoCompleteResultsInitialState::class);
$context->registerNotifierService(Notifier::class);
}
public function boot(IBootContext $context): void {
}
}