Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
c8c8f93
Move createSubscription and deleteSubscription event handlers to
tcitworld Dec 17, 2021
bfdfd3e
Remove uses of LegacyDispatcher for create/delete subscriptions
tcitworld Dec 17, 2021
dfa2cc3
Move every event to listeners and remove all uses of legacy dispatcher
tcitworld Dec 17, 2021
10af3ab
Add tests for new Listeners
tcitworld Dec 17, 2021
180e695
Remove usages of legacyDispatcher in CardDAVBackend
tcitworld Dec 19, 2021
ab07629
Update some depreciated calls
tcitworld Dec 19, 2021
08abaae
Fix doctype of param passed to deleteContact
tcitworld Dec 19, 2021
4827bc7
Improve OCA\DAV\Connector\Sabre\Principal
tcitworld Dec 19, 2021
aa7994f
Improve OCA\DAV\Tests\unit\CardDAV\AddressBookImplTest
tcitworld Dec 19, 2021
3a3a1a0
Move uses of ILogger to LoggerInterface
tcitworld Dec 19, 2021
fed15f9
Move some events to IEventDispatcher
tcitworld Dec 19, 2021
c304561
Replace calls to Sabre's depreciated getPropertiesForPath with getPro…
tcitworld Jan 16, 2022
981b99c
Remove more depreciated calls
tcitworld Jan 20, 2022
dcc9c70
Remove HookManager and replace with UserChangeListener
tcitworld Jan 20, 2022
7a5f4af
Modernize endpoints
tcitworld Jan 20, 2022
d739f92
Modernize Sabre Connector
tcitworld Jan 20, 2022
244aaa7
Add @template-implements metadata for listeners
tcitworld Jan 20, 2022
57ddf28
Remove CalendarManager registration
tcitworld Jan 20, 2022
fccc89d
Various fixes
tcitworld Jan 20, 2022
041526d
Improve tests
tcitworld Jan 26, 2022
3d42336
Improve CommentsEntityEvent
tcitworld Jan 26, 2022
9246d06
Use PHP 7.4 typed properties
tcitworld Feb 14, 2022
6d6008d
Rebasing, cs and more typing
tcitworld Mar 24, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Remove HookManager and replace with UserChangeListener
Signed-off-by: Thomas Citharel <[email protected]>
  • Loading branch information
tcitworld committed Mar 31, 2022
commit dcc9c703913f5612b677953973b42bea742071d7
3 changes: 2 additions & 1 deletion apps/dav/composer/composer/autoload_classmap.php
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@
'OCA\\DAV\\Events\\CardCreatedEvent' => $baseDir . '/../lib/Events/CardCreatedEvent.php',
'OCA\\DAV\\Events\\CardDeletedEvent' => $baseDir . '/../lib/Events/CardDeletedEvent.php',
'OCA\\DAV\\Events\\CardUpdatedEvent' => $baseDir . '/../lib/Events/CardUpdatedEvent.php',
'OCA\\DAV\\Events\\SabreAddPluginEvent' => $baseDir . '/../lib/Events/SabreAddPluginEvent.php',
'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => $baseDir . '/../lib/Events/SabrePluginAuthInitEvent.php',
'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => $baseDir . '/../lib/Events/SubscriptionCreatedEvent.php',
'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => $baseDir . '/../lib/Events/SubscriptionDeletedEvent.php',
Expand All @@ -232,7 +233,6 @@
'OCA\\DAV\\Files\\RootCollection' => $baseDir . '/../lib/Files/RootCollection.php',
'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => $baseDir . '/../lib/Files/Sharing/FilesDropPlugin.php',
'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => $baseDir . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
'OCA\\DAV\\HookManager' => $baseDir . '/../lib/HookManager.php',
'OCA\\DAV\\Listener\\ActivityUpdaterListener' => $baseDir . '/../lib/Listener/ActivityUpdaterListener.php',
'OCA\\DAV\\Listener\\AddressbookListener' => $baseDir . '/../lib/Listener/AddressbookListener.php',
'OCA\\DAV\\Listener\\BirthdayListener' => $baseDir . '/../lib/Listener/BirthdayListener.php',
Expand All @@ -246,6 +246,7 @@
'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => $baseDir . '/../lib/Listener/ClearPhotoCacheListener.php',
'OCA\\DAV\\Listener\\SubscriptionCreationListener' => $baseDir . '/../lib/Listener/SubscriptionCreationListener.php',
'OCA\\DAV\\Listener\\SubscriptionDeletionListener' => $baseDir . '/../lib/Listener/SubscriptionDeletionListener.php',
'OCA\\DAV\\Listener\\UserChangeListener' => $baseDir . '/../lib/Listener/UserChangeListener.php',
'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndex.php',
'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => $baseDir . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => $baseDir . '/../lib/Migration/BuildSocialSearchIndex.php',
Expand Down
3 changes: 2 additions & 1 deletion apps/dav/composer/composer/autoload_static.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Events\\CardCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardCreatedEvent.php',
'OCA\\DAV\\Events\\CardDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/CardDeletedEvent.php',
'OCA\\DAV\\Events\\CardUpdatedEvent' => __DIR__ . '/..' . '/../lib/Events/CardUpdatedEvent.php',
'OCA\\DAV\\Events\\SabreAddPluginEvent' => __DIR__ . '/..' . '/../lib/Events/SabreAddPluginEvent.php',
'OCA\\DAV\\Events\\SabrePluginAuthInitEvent' => __DIR__ . '/..' . '/../lib/Events/SabrePluginAuthInitEvent.php',
'OCA\\DAV\\Events\\SubscriptionCreatedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionCreatedEvent.php',
'OCA\\DAV\\Events\\SubscriptionDeletedEvent' => __DIR__ . '/..' . '/../lib/Events/SubscriptionDeletedEvent.php',
Expand All @@ -247,7 +248,6 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Files\\RootCollection' => __DIR__ . '/..' . '/../lib/Files/RootCollection.php',
'OCA\\DAV\\Files\\Sharing\\FilesDropPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/FilesDropPlugin.php',
'OCA\\DAV\\Files\\Sharing\\PublicLinkCheckPlugin' => __DIR__ . '/..' . '/../lib/Files/Sharing/PublicLinkCheckPlugin.php',
'OCA\\DAV\\HookManager' => __DIR__ . '/..' . '/../lib/HookManager.php',
'OCA\\DAV\\Listener\\ActivityUpdaterListener' => __DIR__ . '/..' . '/../lib/Listener/ActivityUpdaterListener.php',
'OCA\\DAV\\Listener\\AddressbookListener' => __DIR__ . '/..' . '/../lib/Listener/AddressbookListener.php',
'OCA\\DAV\\Listener\\BirthdayListener' => __DIR__ . '/..' . '/../lib/Listener/BirthdayListener.php',
Expand All @@ -261,6 +261,7 @@ class ComposerStaticInitDAV
'OCA\\DAV\\Listener\\ClearPhotoCacheListener' => __DIR__ . '/..' . '/../lib/Listener/ClearPhotoCacheListener.php',
'OCA\\DAV\\Listener\\SubscriptionCreationListener' => __DIR__ . '/..' . '/../lib/Listener/SubscriptionCreationListener.php',
'OCA\\DAV\\Listener\\SubscriptionDeletionListener' => __DIR__ . '/..' . '/../lib/Listener/SubscriptionDeletionListener.php',
'OCA\\DAV\\Listener\\UserChangeListener' => __DIR__ . '/..' . '/../lib/Listener/UserChangeListener.php',
'OCA\\DAV\\Migration\\BuildCalendarSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndex.php',
'OCA\\DAV\\Migration\\BuildCalendarSearchIndexBackgroundJob' => __DIR__ . '/..' . '/../lib/Migration/BuildCalendarSearchIndexBackgroundJob.php',
'OCA\\DAV\\Migration\\BuildSocialSearchIndex' => __DIR__ . '/..' . '/../lib/Migration/BuildSocialSearchIndex.php',
Expand Down
4 changes: 2 additions & 2 deletions apps/dav/composer/composer/installed.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => 'e2c675724fc4ea50f1275bf0027b96f277c32578',
'reference' => 'a25928fb43d5f308719762b57ad826135d91c3f1',
'name' => '__root__',
'dev' => false,
),
Expand All @@ -16,7 +16,7 @@
'type' => 'library',
'install_path' => __DIR__ . '/../',
'aliases' => array(),
'reference' => 'e2c675724fc4ea50f1275bf0027b96f277c32578',
'reference' => 'a25928fb43d5f308719762b57ad826135d91c3f1',
'dev_requirement' => false,
),
),
Expand Down
19 changes: 14 additions & 5 deletions apps/dav/lib/AppInfo/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@
use OCA\DAV\Events\CardUpdatedEvent;
use OCA\DAV\Events\SubscriptionCreatedEvent;
use OCA\DAV\Events\SubscriptionDeletedEvent;
use OCA\DAV\HookManager;
use OCA\DAV\Listener\ActivityUpdaterListener;
use OCA\DAV\Listener\AddressbookListener;
use OCA\DAV\Listener\BirthdayListener;
Expand All @@ -84,6 +83,7 @@
use OCA\DAV\Listener\ClearPhotoCacheListener;
use OCA\DAV\Listener\SubscriptionCreationListener;
use OCA\DAV\Listener\SubscriptionDeletionListener;
use OCA\DAV\Listener\UserChangeListener;
use OCA\DAV\Search\ContactsSearchProvider;
use OCA\DAV\Search\EventsSearchProvider;
use OCA\DAV\Search\TasksSearchProvider;
Expand All @@ -100,6 +100,10 @@
use OCP\IURLGenerator;
use OCP\IUser;
use OCP\IUserSession;
use OCP\User\Events\BeforeUserDeletedEvent;
use OCP\User\Events\UserChangedEvent;
use OCP\User\Events\UserCreatedEvent;
use OCP\User\Events\UserDeletedEvent;
use Psr\Container\ContainerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
Expand Down Expand Up @@ -184,6 +188,11 @@ public function register(IRegistrationContext $context): void {
$context->registerEventListener(CardDeletedEvent::class, ClearPhotoCacheListener::class);
$context->registerEventListener(CardUpdatedEvent::class, ClearPhotoCacheListener::class);

$context->registerEventListener(UserCreatedEvent::class, UserChangeListener::class);
$context->registerEventListener(BeforeUserDeletedEvent::class, UserChangeListener::class);
$context->registerEventListener(UserDeletedEvent::class, UserChangeListener::class);
$context->registerEventListener(UserChangedEvent::class, UserChangeListener::class);

$context->registerNotifierService(Notifier::class);

$context->registerCalendarProvider(CalendarProvider::class);
Expand All @@ -201,16 +210,16 @@ public function boot(IBootContext $context): void {
$context->injectFn([$this, 'registerCalendarReminders']);
}

public function registerHooks(HookManager $hm,
public function registerHooks(UserChangeListener $userChangeListener,
EventDispatcherInterface $dispatcher,
IAppContainer $container,
IServerContainer $serverContainer) {
$hm->setup();
$userChangeListener->setupLegacyHooks();

// first time login event setup
$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($hm) {
$dispatcher->addListener(IUser::class . '::firstLogin', function ($event) use ($userChangeListener) {
if ($event instanceof GenericEvent) {
$hm->firstLogin($event->getSubject());
$userChangeListener->firstLogin($event->getSubject());
}
});

Expand Down
195 changes: 0 additions & 195 deletions apps/dav/lib/HookManager.php

This file was deleted.

Loading