diff options
author | Joas Schilling <coding@schilljs.com> | 2023-07-27 21:45:31 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2023-07-28 14:11:19 +0200 |
commit | 44b810bfbd83fc6eb95a67430894dbd2cf6eb339 (patch) | |
tree | bebee497a72c8cc05dc171503211888c97184f69 /apps/files_sharing/lib | |
parent | 68fc9b48c24bf810488c5910da2feadd10587e51 (diff) | |
download | nextcloud-server-44b810bfbd83fc6eb95a67430894dbd2cf6eb339.tar.gz nextcloud-server-44b810bfbd83fc6eb95a67430894dbd2cf6eb339.zip |
feat!: Migrate Sharing events to typed events
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/AppInfo/Application.php | 5 | ||||
-rw-r--r-- | apps/files_sharing/lib/Notification/Listener.php | 9 |
2 files changed, 4 insertions, 10 deletions
diff --git a/apps/files_sharing/lib/AppInfo/Application.php b/apps/files_sharing/lib/AppInfo/Application.php index 65197e9b270..8f5fe7aca5b 100644 --- a/apps/files_sharing/lib/AppInfo/Application.php +++ b/apps/files_sharing/lib/AppInfo/Application.php @@ -143,10 +143,7 @@ class Application extends App implements IBootstrap { }); // notifications api to accept incoming user shares - $dispatcher->addListener('OCP\Share::postShare', function ($event) { - if (!$event instanceof OldGenericEvent) { - return; - } + $dispatcher->addListener(ShareCreatedEvent::class, function (ShareCreatedEvent $event) { /** @var Listener $listener */ $listener = $this->getContainer()->query(Listener::class); $listener->shareNotification($event); diff --git a/apps/files_sharing/lib/Notification/Listener.php b/apps/files_sharing/lib/Notification/Listener.php index db7939767d6..b6d30cdb3f5 100644 --- a/apps/files_sharing/lib/Notification/Listener.php +++ b/apps/files_sharing/lib/Notification/Listener.php @@ -31,6 +31,7 @@ use OCP\IGroupManager; use OCP\IUser; use OCP\Notification\IManager as INotificationManager; use OCP\Notification\INotification; +use OCP\Share\Events\ShareCreatedEvent; use OCP\Share\IManager as IShareManager; use OCP\Share\IShare; use Symfony\Component\EventDispatcher\GenericEvent; @@ -54,12 +55,8 @@ class Listener { $this->groupManager = $groupManager; } - /** - * @param GenericEvent $event - */ - public function shareNotification(GenericEvent $event): void { - /** @var IShare $share */ - $share = $event->getSubject(); + public function shareNotification(ShareCreatedEvent $event): void { + $share = $event->getShare(); $notification = $this->instantiateNotification($share); if ($share->getShareType() === IShare::TYPE_USER) { |