diff options
author | Joas Schilling <coding@schilljs.com> | 2022-09-19 21:36:50 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2022-09-19 21:36:50 +0200 |
commit | 144514e49e25b7b123fd535902fee97fa39fb446 (patch) | |
tree | 96fcf53152de6377d3caa9471fb143cbd91d2288 | |
parent | ea08fabca3c10370d393ab10480fd82c36e1eaac (diff) | |
download | nextcloud-server-144514e49e25b7b123fd535902fee97fa39fb446.tar.gz nextcloud-server-144514e49e25b7b123fd535902fee97fa39fb446.zip |
Fix avatar cleanup on user delete
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r-- | lib/private/Server.php | 6 | ||||
-rw-r--r-- | lib/private/User/Listeners/BeforeUserDeletedListener.php (renamed from lib/private/User/Listeners/UserDeletedListener.php) | 10 |
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/private/Server.php b/lib/private/Server.php index c1a50cfcaff..e7f4019e00b 100644 --- a/lib/private/Server.php +++ b/lib/private/Server.php @@ -153,8 +153,8 @@ use OC\Tagging\TagMapper; use OC\Talk\Broker; use OC\Template\JSCombiner; use OC\User\DisplayNameCache; +use OC\User\Listeners\BeforeUserDeletedListener; use OC\User\Listeners\UserChangedListener; -use OC\User\Listeners\UserDeletedListener; use OCA\Theming\ImageManager; use OCA\Theming\ThemingDefaults; use OCA\Theming\Util; @@ -248,13 +248,13 @@ use OCP\SystemTag\ISystemTagManager; use OCP\SystemTag\ISystemTagObjectMapper; use OCP\Talk\IBroker; use OCP\User\Events\BeforePasswordUpdatedEvent; +use OCP\User\Events\BeforeUserDeletedEvent; use OCP\User\Events\BeforeUserLoggedInEvent; use OCP\User\Events\BeforeUserLoggedInWithCookieEvent; use OCP\User\Events\BeforeUserLoggedOutEvent; use OCP\User\Events\PasswordUpdatedEvent; use OCP\User\Events\PostLoginEvent; use OCP\User\Events\UserChangedEvent; -use OCP\User\Events\UserDeletedEvent; use OCP\User\Events\UserLoggedInEvent; use OCP\User\Events\UserLoggedInWithCookieEvent; use OCP\User\Events\UserLoggedOutEvent; @@ -1499,7 +1499,7 @@ class Server extends ServerContainer implements IServerContainer { $eventDispatcher->addServiceListener(LoginFailed::class, LoginFailedListener::class); $eventDispatcher->addServiceListener(PostLoginEvent::class, UserLoggedInListener::class); $eventDispatcher->addServiceListener(UserChangedEvent::class, UserChangedListener::class); - $eventDispatcher->addServiceListener(UserDeletedEvent::class, UserDeletedListener::class); + $eventDispatcher->addServiceListener(BeforeUserDeletedEvent::class, BeforeUserDeletedListener::class); } /** diff --git a/lib/private/User/Listeners/UserDeletedListener.php b/lib/private/User/Listeners/BeforeUserDeletedListener.php index 7c9c46ef371..ec1f80c5413 100644 --- a/lib/private/User/Listeners/UserDeletedListener.php +++ b/lib/private/User/Listeners/BeforeUserDeletedListener.php @@ -25,15 +25,15 @@ namespace OC\User\Listeners; use OCP\EventDispatcher\Event; use OCP\EventDispatcher\IEventListener; -use OCP\User\Events\UserDeletedEvent; +use OCP\User\Events\BeforeUserDeletedEvent; use OCP\Files\NotFoundException; use OCP\IAvatarManager; use Psr\Log\LoggerInterface; /** - * @template-implements IEventListener<UserDeletedEvent> + * @template-implements IEventListener<BeforeUserDeletedEvent> */ -class UserDeletedListener implements IEventListener { +class BeforeUserDeletedListener implements IEventListener { private IAvatarManager $avatarManager; private LoggerInterface $logger; @@ -43,10 +43,10 @@ class UserDeletedListener implements IEventListener { } public function handle(Event $event): void { - if (!($event instanceof UserDeletedEvent)) { + if (!($event instanceof BeforeUserDeletedEvent)) { return; } - + $user = $event->getUser(); // Delete avatar on user deletion |