Skip to content

Commit

Permalink
refactor(Application): Migrate to typed GroupDeletedEvent event
Browse files Browse the repository at this point in the history
Signed-off-by: provokateurin <kate@provokateurin.de>
  • Loading branch information
provokateurin committed Sep 19, 2024
1 parent 64b2676 commit 51c87fd
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
namespace OCA\GroupFolders\AppInfo;

use OC\Files\Node\LazyFolder;
use OC\Group;
use OCA\Circles\Events\CircleDestroyedEvent;
use OCA\DAV\Connector\Sabre\Principal;
use OCA\Files\Event\LoadAdditionalScriptsEvent;
Expand Down Expand Up @@ -49,10 +48,10 @@
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\IDBConnection;
use OCP\IGroup;
use OCP\IRequest;
use OCP\IUserManager;
use OCP\IUserSession;
Expand Down Expand Up @@ -236,11 +235,11 @@ public function register(IRegistrationContext $context): void {
}

public function boot(IBootContext $context): void {
$context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, Group\Manager $groupManager): void {
$context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, IEventDispatcher $eventDispatcher): void {
$mountProviderCollection->registerProvider(Server::get(MountProvider::class));

$groupManager->listen('\OC\Group', 'postDelete', function (IGroup $group): void {
Server::get(FolderManager::class)->deleteGroup($group->getGID());
$eventDispatcher->addListener(GroupDeletedEvent::class, function (GroupDeletedEvent $event): void {
Server::get(FolderManager::class)->deleteGroup($event->getGroup()->getGID());
});
$cacheListener->listen();
});
Expand Down

0 comments on commit 51c87fd

Please sign in to comment.