diff options
author | Joas Schilling <coding@schilljs.com> | 2021-08-25 12:10:59 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2021-08-25 12:10:59 +0300 |
commit | f813c3f7ffa9e1d6d981f7fb137d26692470695c (patch) | |
tree | 3c74858b15829435346de72108947af2dac709f5 /lib/Service | |
parent | 7071e7640e8b9fcc8b6733ae7a5704e05ca4bdb2 (diff) |
Update API usage to new API level
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Service')
-rw-r--r-- | lib/Service/ParticipantService.php | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/lib/Service/ParticipantService.php b/lib/Service/ParticipantService.php index 55cc0fad9..fc6d312c8 100644 --- a/lib/Service/ParticipantService.php +++ b/lib/Service/ParticipantService.php @@ -24,8 +24,10 @@ declare(strict_types=1); namespace OCA\Talk\Service; use OCA\Circles\Api\v1\Circles; +use OCA\Circles\CirclesManager; use OCA\Circles\Model\Circle; use OCA\Circles\Model\Member; +use OCA\Circles\Model\Probes\CircleProbe; use OCA\Talk\Config; use OCA\Talk\Events\AddParticipantsEvent; use OCA\Talk\Events\AttendeesAddedEvent; @@ -411,20 +413,23 @@ class ParticipantService { */ public function getCircle(string $circleId, string $userId): Circle { try { - $circle = Circles::detailsCircle($circleId); + $circlesManager = \OC::$server->get(CirclesManager::class); + $federatedUser = $circlesManager->getFederatedUser($userId, Member::TYPE_USER); + $federatedUser->getLink($circleId); } catch (\Exception $e) { - throw new ParticipantNotFoundException('Circle not found'); + throw new ParticipantNotFoundException('Circle not found or not a member'); } - // FIXME use \OCA\Circles\Manager::getLink() in the future - $membersInCircle = $circle->getInheritedMembers(); - foreach ($membersInCircle as $member) { - if ($member->isLocal() && $member->getUserType() === Member::TYPE_USER && $member->getUserId() === $userId) { - return $circle; - } + $circlesManager->startSession($federatedUser); + try { + $circle = $circlesManager->getCircle($circleId); + $circlesManager->stopSession($federatedUser); + return $circle; + } catch (\Exception $e) { } - throw new ParticipantNotFoundException('Circle found but not a member'); + $circlesManager->stopSession($federatedUser); + throw new ParticipantNotFoundException('Circle not found or not a member'); } /** |