fix: Use typed share event
Signed-off-by: Julius Härtl <jus@bitgrid.net>
This commit is contained in:
@@ -30,9 +30,9 @@ use OC\Files\Filesystem;
|
||||
use OCA\Deck\Service\ConfigService;
|
||||
use OCP\EventDispatcher\IEventDispatcher;
|
||||
use OCP\Server;
|
||||
use OCP\Share\Events\BeforeShareCreatedEvent;
|
||||
use OCP\Share\Events\VerifyMountPointEvent;
|
||||
use OCP\Share\IShare;
|
||||
use Symfony\Component\EventDispatcher\GenericEvent;
|
||||
|
||||
class Listener {
|
||||
private ConfigService $configService;
|
||||
@@ -45,11 +45,11 @@ class Listener {
|
||||
/**
|
||||
* @psalm-suppress UndefinedClass
|
||||
*/
|
||||
$dispatcher->addListener('OCP\Share::preShare', [self::class, 'listenPreShare'], 1000);
|
||||
$dispatcher->addListener(BeforeShareCreatedEvent::class, [self::class, 'listenPreShare'], 1000);
|
||||
$dispatcher->addListener(VerifyMountPointEvent::class, [self::class, 'listenVerifyMountPointEvent'], 1000);
|
||||
}
|
||||
|
||||
public static function listenPreShare(GenericEvent $event): void {
|
||||
public static function listenPreShare(BeforeShareCreatedEvent $event): void {
|
||||
/** @var self $listener */
|
||||
$listener = Server::get(self::class);
|
||||
$listener->overwriteShareTarget($event);
|
||||
@@ -61,9 +61,8 @@ class Listener {
|
||||
$listener->overwriteMountPoint($event);
|
||||
}
|
||||
|
||||
public function overwriteShareTarget(GenericEvent $event): void {
|
||||
/** @var IShare $share */
|
||||
$share = $event->getSubject();
|
||||
public function overwriteShareTarget(BeforeShareCreatedEvent $event): void {
|
||||
$share = $event->getShare();
|
||||
|
||||
if ($share->getShareType() !== IShare::TYPE_DECK
|
||||
&& $share->getShareType() !== DeckShareProvider::SHARE_TYPE_DECK_USER) {
|
||||
|
||||
Reference in New Issue
Block a user