From eaadd37ca06e339535a50776451a0168a6b1ef55 Mon Sep 17 00:00:00 2001 From: Julien Veyssier Date: Sun, 8 Sep 2024 22:46:11 +0200 Subject: [PATCH] fix federated unshare msg handling Signed-off-by: Julien Veyssier --- .../CloudFederationProviderCospend.php | 25 +++---------------- 1 file changed, 4 insertions(+), 21 deletions(-) diff --git a/lib/Federation/CloudFederationProviderCospend.php b/lib/Federation/CloudFederationProviderCospend.php index 5aab739d..9a112602 100644 --- a/lib/Federation/CloudFederationProviderCospend.php +++ b/lib/Federation/CloudFederationProviderCospend.php @@ -195,31 +195,14 @@ class CloudFederationProviderCospend implements ICloudFederationProvider { /** * @throws ActionNotSupportedException - * @throws ShareNotFound * @throws AuthenticationFailedException + * @throws DBException + * @throws MultipleObjectsReturnedException + * @throws ShareNotFound */ private function shareUnshared(string $providerId, array $notification): array { $invite = $this->getInviteByRemoteProjectIdAndValidate($notification['remoteServerUrl'], $providerId, $notification['sharedSecret']); - try { - $room = $this->manager->getRoomById($invite->getLocalRoomId()); - } catch (RoomNotFoundException) { - throw new ShareNotFound(FederationManager::OCM_RESOURCE_NOT_FOUND); - } - - // Sanity check to make sure the room is a remote room - if (!$room->isFederatedConversation()) { - throw new ShareNotFound(FederationManager::OCM_RESOURCE_NOT_FOUND); - } - $this->invitationMapper->delete($invite); - - try { - $participant = $this->participantService->getParticipantByActor($room, Attendee::ACTOR_USERS, $invite->getUserId()); - $this->participantService->removeAttendee($room, $participant, AAttendeeRemovedEvent::REASON_REMOVED); - } catch (ParticipantNotFoundException) { - // Never accepted the invite - } - return []; } @@ -275,7 +258,7 @@ class CloudFederationProviderCospend implements ICloudFederationProvider { $remoteServerUrl = preg_replace('/^https?:\/\//i', '', $remoteServerUrl); try { - return $this->invitationMapper->getByRemoteAndToken($remoteServerUrl, $remoteProjectId, $sharedSecret); + return $this->invitationMapper->getByRemoteAndToken($remoteProjectId, $remoteServerUrl, $sharedSecret); } catch (DoesNotExistException) { throw new ShareNotFound(FederationManager::OCM_RESOURCE_NOT_FOUND); }