From 485864bbcc88ba43a80bde42d4b463b46c01809f Mon Sep 17 00:00:00 2001 From: navid-shokri <123634558+navid-shokri@users.noreply.github.com> Date: Wed, 5 Apr 2023 09:20:01 +0000 Subject: [PATCH] do forgotten operation for handeling NOTIFICATION_TYPE_SHARE_ACCEPTED notificatio --- .../lib/Controller/OcmController.php | 25 +++++++++++++++---- 1 file changed, 20 insertions(+), 5 deletions(-) diff --git a/apps/federatedfilesharing/lib/Controller/OcmController.php b/apps/federatedfilesharing/lib/Controller/OcmController.php index b2fcedcdc6d1..791b8ec9f45d 100644 --- a/apps/federatedfilesharing/lib/Controller/OcmController.php +++ b/apps/federatedfilesharing/lib/Controller/OcmController.php @@ -336,11 +336,26 @@ public function processNotification( switch ($notificationType) { case FileNotification::NOTIFICATION_TYPE_SHARE_ACCEPTED: $this->ocmMiddleware->assertOutgoingSharingEnabled(); - $share = $this->ocmMiddleware->getValidShare( - $providerId, - $notification['sharedSecret'] - ); - $this->fedShareManager->acceptShare($share); + $share = null; + try{ + $share = $this->ocmMiddleware->getValidShare( + $providerId, + $notification['sharedSecret'] + ); + $this->fedShareManager->acceptShare($share); + }catch(ShareNotFound $ex){ + + if (\OC::$server->getAppManager()->isEnabledForUser('federatedgroups')) { + $groupOcmMiddleware = \OCA\FederatedGroups\AppInfo\Application::getOcmMiddleware(); + $share = $groupOcmMiddleware->getValidShare( + $providerId, + $notification['sharedSecret'] + ); + $groupFedShareManager = \OCA\FederatedGroups\AppInfo\Application::getFedSharemanager(); + $groupFedShareManager->acceptShare($share); + } + } + break; case FileNotification::NOTIFICATION_TYPE_SHARE_DECLINED: $this->ocmMiddleware->assertOutgoingSharingEnabled();