diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/private/Share20/LegacyHooks.php | 15 | ||||
-rw-r--r-- | lib/private/Share20/Manager.php | 2 |
2 files changed, 17 insertions, 0 deletions
diff --git a/lib/private/Share20/LegacyHooks.php b/lib/private/Share20/LegacyHooks.php index 09acf6c50e7..e7fbe7336b8 100644 --- a/lib/private/Share20/LegacyHooks.php +++ b/lib/private/Share20/LegacyHooks.php @@ -40,6 +40,7 @@ class LegacyHooks { $this->eventDispatcher->addListener('OCP\Share::preUnshare', [$this, 'preUnshare']); $this->eventDispatcher->addListener('OCP\Share::postUnshare', [$this, 'postUnshare']); + $this->eventDispatcher->addListener('OCP\Share::postUnshareFromSelf', [$this, 'postUnshareFromSelf']); } /** @@ -74,6 +75,20 @@ class LegacyHooks { \OC_Hook::emit('OCP\Share', 'post_unshare', $formatted); } + /** + * @param GenericEvent $e + */ + public function postUnshareFromSelf(GenericEvent $e) { + /** @var IShare $share */ + $share = $e->getSubject(); + + $formatted = $this->formatHookParams($share); + $formatted['itemTarget'] = $formatted['fileTarget']; + $formatted['unsharedItems'] = [$formatted]; + + \OC_Hook::emit('OCP\Share', 'post_unshareFromSelf', $formatted); + } + private function formatHookParams(IShare $share) { // Prepare hook $shareType = $share->getShareType(); diff --git a/lib/private/Share20/Manager.php b/lib/private/Share20/Manager.php index f64ae5d39ee..ca9d8e2843f 100644 --- a/lib/private/Share20/Manager.php +++ b/lib/private/Share20/Manager.php @@ -871,6 +871,8 @@ class Manager implements IManager { $provider = $this->factory->getProvider($providerId); $provider->deleteFromSelf($share, $recipientId); + $event = new GenericEvent($share); + $this->eventDispatcher->dispatch('OCP\Share::postUnshareFromSelf', $event); } /** |