From 3a0e2c14ab6b8f37e071982f1df5bb52ba672455 Mon Sep 17 00:00:00 2001 From: provokateurin Date: Thu, 19 Sep 2024 11:31:57 +0200 Subject: [PATCH] refactor(Application): Migrate to typed GroupDeletedEvent event Signed-off-by: provokateurin --- lib/AppInfo/Application.php | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 4145888d6..a27ab8fd8 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -55,17 +55,18 @@ use OCP\AppFramework\Bootstrap\IBootstrap; use OCP\AppFramework\Bootstrap\IRegistrationContext; use OCP\AppFramework\Utility\ITimeFactory; +use OCP\EventDispatcher\IEventDispatcher; use OCP\Files\Config\IMountProviderCollection; use OCP\Files\Events\Node\NodeRenamedEvent; use OCP\Files\Folder; use OCP\Files\IMimeTypeLoader; use OCP\Files\IRootFolder; use OCP\Files\NotFoundException; +use OCP\Group\Events\GroupDeletedEvent; use OCP\IAppConfig; use OCP\ICacheFactory; use OCP\IConfig; use OCP\IDBConnection; -use OCP\IGroup; use OCP\IGroupManager; use OCP\IRequest; use OCP\ISession; @@ -240,11 +241,11 @@ public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { - $context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, IGroupManager $groupManager): void { + $context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, IEventDispatcher $eventDispatcher): void { $mountProviderCollection->registerProvider($this->getMountProvider()); - $groupManager->listen('\OC\Group', 'postDelete', function (IGroup $group) { - $this->getFolderManager()->deleteGroup($group->getGID()); + $eventDispatcher->addListener(GroupDeletedEvent::class, function (GroupDeletedEvent $event): void { + $this->getFolderManager()->deleteGroup($event->getGroup()->getGID()); }); $cacheListener->listen(); });