Merge pull request #4997 from nextcloud/bugfix/noid/share-event

This commit is contained in:
Julius Härtl
2023-08-08 10:20:18 +02:00
committed by GitHub
2 changed files with 9 additions and 10 deletions

8
composer.lock generated
View File

@@ -254,12 +254,12 @@
"source": {
"type": "git",
"url": "https://github.com/nextcloud-deps/ocp.git",
"reference": "13aca78b1a060e2e2274e660b6954597e13a7035"
"reference": "7840fe73084751b843b69d263b4ba70e59c63750"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/13aca78b1a060e2e2274e660b6954597e13a7035",
"reference": "13aca78b1a060e2e2274e660b6954597e13a7035",
"url": "https://api.github.com/repos/nextcloud-deps/ocp/zipball/7840fe73084751b843b69d263b4ba70e59c63750",
"reference": "7840fe73084751b843b69d263b4ba70e59c63750",
"shasum": ""
},
"require": {
@@ -291,7 +291,7 @@
"issues": "https://github.com/nextcloud-deps/ocp/issues",
"source": "https://github.com/nextcloud-deps/ocp/tree/master"
},
"time": "2023-07-29T00:34:58+00:00"
"time": "2023-08-04T12:45:05+00:00"
},
{
"name": "nikic/php-parser",

View File

@@ -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) {