diff options
author | Gary Kim <gary@garykim.dev> | 2021-07-02 17:11:10 -0400 |
---|---|---|
committer | Gary Kim <gary@garykim.dev> | 2021-07-15 13:55:19 -0400 |
commit | c49a1c27544ab0a4014a2ff385285d2bb556e5e6 (patch) | |
tree | 4042f64913e3615429e77e9c4cfba848f6ad0ef0 /lib/Federation/CloudFederationProviderTalk.php | |
parent | 5219c0deb24dfccb11794447da52bddfeb3d9cc9 (diff) |
Review fixes
Signed-off-by: Gary Kim <gary@garykim.dev>
Diffstat (limited to 'lib/Federation/CloudFederationProviderTalk.php')
-rw-r--r-- | lib/Federation/CloudFederationProviderTalk.php | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/lib/Federation/CloudFederationProviderTalk.php b/lib/Federation/CloudFederationProviderTalk.php index 909b09e34..1bd555458 100644 --- a/lib/Federation/CloudFederationProviderTalk.php +++ b/lib/Federation/CloudFederationProviderTalk.php @@ -26,13 +26,13 @@ declare(strict_types=1); namespace OCA\Talk\Federation; use Exception; -use OC\HintException; use OCA\FederatedFileSharing\AddressHandler; use OCA\Talk\AppInfo\Application; use OCA\Talk\Manager; use OCA\Talk\Model\Attendee; use OCA\Talk\Model\AttendeeMapper; use OCA\Talk\Participant; +use OCA\Talk\Room; use OCA\Talk\Service\ParticipantService; use OCP\AppFramework\Http; use OCP\DB\Exception as DBException; @@ -42,6 +42,7 @@ use OCP\Federation\Exceptions\BadRequestException; use OCP\Federation\Exceptions\ProviderCouldNotAddShareException; use OCP\Federation\ICloudFederationProvider; use OCP\Federation\ICloudFederationShare; +use OCP\HintException; use OCP\IURLGenerator; use OCP\IUser; use OCP\IUserManager; @@ -110,8 +111,8 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { if (!$this->federationManager->isEnabled()) { throw new ProviderCouldNotAddShareException('Server does not support talk federation', '', Http::STATUS_SERVICE_UNAVAILABLE); } - if ($share->getShareType() !== 'user') { - throw new ProviderCouldNotAddShareException('support for sharing with non-users not implemented yet', '', Http::STATUS_NOT_IMPLEMENTED); + if (!in_array($share->getShareType(), $this->getSupportedShareTypes(), true)) { + throw new ProviderCouldNotAddShareException('Support for sharing with non-users not implemented yet', '', Http::STATUS_NOT_IMPLEMENTED); // TODO: Implement group shares } @@ -199,7 +200,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { $room = $this->manager->getRoomById($attendee->getRoomId()); $participant = new Participant($room, $attendee, null); - $this->participantService->removeAttendee($room, $participant, 'Left Room'); + $this->participantService->removeAttendee($room, $participant, Room::PARTICIPANT_LEFT); return []; } @@ -218,7 +219,7 @@ class CloudFederationProviderTalk implements ICloudFederationProvider { } catch (Exception $ex) { throw new ShareNotFound(); } - if ($attendee->getActorType() !== Attendee::ACTOR_FEDERATED_REMOTE_USER) { + if ($attendee->getActorType() !== Attendee::ACTOR_FEDERATED_USERS) { throw new ShareNotFound(); } if ($attendee->getAccessToken() !== $sharedSecret) { |