fix: delete UserStatusAutomation when user is deleted

Signed-off-by: Salvatore Martire <4652631+salmart-dev@users.noreply.github.com>
This commit is contained in:
Salvatore Martire 2025-06-30 18:09:57 +02:00
parent e4183236ed
commit 125696bfbc

View file

@ -9,12 +9,14 @@ declare(strict_types=1);
namespace OCA\DAV\Listener;
use OCA\DAV\BackgroundJob\UserStatusAutomation;
use OCA\DAV\CalDAV\CalDavBackend;
use OCA\DAV\CardDAV\CardDavBackend;
use OCA\DAV\CardDAV\SyncService;
use OCA\DAV\Service\ExampleContactService;
use OCA\DAV\Service\ExampleEventService;
use OCP\Accounts\UserUpdatedEvent;
use OCP\BackgroundJob\IJobList;
use OCP\Defaults;
use OCP\EventDispatcher\Event;
use OCP\EventDispatcher\IEventListener;
@ -49,6 +51,7 @@ class UserEventsListener implements IEventListener {
private ExampleContactService $exampleContactService,
private ExampleEventService $exampleEventService,
private LoggerInterface $logger,
private IJobList $jobList,
) {
}
@ -124,6 +127,8 @@ class UserEventsListener implements IEventListener {
$this->cardDav->deleteAddressBook($addressBook['id']);
}
$this->jobList->remove(UserStatusAutomation::class, ['userId' => $uid]);
unset($this->calendarsToDelete[$uid]);
unset($this->subscriptionsToDelete[$uid]);
unset($this->addressBooksToDelete[$uid]);