diff options
author | Joas Schilling <coding@schilljs.com> | 2020-10-30 16:03:37 +0300 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-11-26 11:46:43 +0300 |
commit | 459858a69527311bf60ffa553d45ba2a7eeec032 (patch) | |
tree | a25ef253ccc64b9b8da3e7c7597a55c8495f3c4f /lib/Manager.php | |
parent | 89f3f351962c2183d1cfeadedd2b6916d7958bc3 (diff) |
Introduce constants for the actor types
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Manager.php')
-rw-r--r-- | lib/Manager.php | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/lib/Manager.php b/lib/Manager.php index 6e02ae666..daf458550 100644 --- a/lib/Manager.php +++ b/lib/Manager.php @@ -27,6 +27,7 @@ use OCA\Talk\Chat\CommentsManager; use OCA\Talk\Events\RoomEvent; use OCA\Talk\Exceptions\ParticipantNotFoundException; use OCA\Talk\Exceptions\RoomNotFoundException; +use OCA\Talk\Model\Attendee; use OCA\Talk\Model\AttendeeMapper; use OCA\Talk\Model\SessionMapper; use OCA\Talk\Service\ParticipantService; @@ -294,7 +295,7 @@ class Manager { ->from('talk_rooms', 'r') ->leftJoin('r', 'talk_attendees', 'a', $query->expr()->andX( $query->expr()->eq('a.actor_id', $query->createNamedParameter($userId)), - $query->expr()->eq('a.actor_type', $query->createNamedParameter('users')), + $query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)), $query->expr()->eq('a.room_id', 'r.id') )) ->where($query->expr()->isNotNull('a.id')); @@ -343,7 +344,7 @@ class Manager { ->selectAlias('a.id', 'a_id') ->leftJoin('r', 'talk_attendees', 'a', $query->expr()->andX( $query->expr()->eq('a.actor_id', $query->createNamedParameter($userId)), - $query->expr()->eq('a.actor_type', $query->createNamedParameter('users')), + $query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)), $query->expr()->eq('a.room_id', 'r.id') )) ->andWhere($query->expr()->isNotNull('a.id')); @@ -398,7 +399,7 @@ class Manager { ->selectAlias('a.id', 'a_id'); $query->leftJoin('r', 'talk_attendees', 'a', $query->expr()->andX( $query->expr()->eq('a.actor_id', $query->createNamedParameter($userId)), - $query->expr()->eq('a.actor_type', $query->createNamedParameter('users')), + $query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)), $query->expr()->eq('a.room_id', 'r.id') )); } @@ -484,7 +485,7 @@ class Manager { ->selectAlias('a.id', 'a_id'); $query->leftJoin('r', 'talk_attendees', 'a', $query->expr()->andX( $query->expr()->eq('a.actor_id', $query->createNamedParameter($preloadUserId)), - $query->expr()->eq('a.actor_type', $query->createNamedParameter('users')), + $query->expr()->eq('a.actor_type', $query->createNamedParameter(Attendee::ACTOR_USERS)), $query->expr()->eq('a.room_id', 'r.id') )); } @@ -571,11 +572,11 @@ class Manager { } if ($userId !== null) { - if ($row['actor_type'] !== 'users' || $userId !== $row['actor_id']) { + if ($row['actor_type'] !== Attendee::ACTOR_USERS || $userId !== $row['actor_id']) { throw new RoomNotFoundException(); } } else { - if ($row['actor_type'] !== 'guests') { + if ($row['actor_type'] !== Attendee::ACTOR_GUESTS) { throw new RoomNotFoundException(); } } @@ -653,7 +654,7 @@ class Manager { $room->setReadOnly(Room::READ_ONLY); $this->participantService->addUsers($room,[[ - 'actorType' => 'users', + 'actorType' => Attendee::ACTOR_USERS, 'actorId' => $userId, ]]); return $room; @@ -665,7 +666,7 @@ class Manager { $room->getParticipant($userId); } catch (ParticipantNotFoundException $e) { $this->participantService->addUsers($room,[[ - 'actorType' => 'users', + 'actorType' => Attendee::ACTOR_USERS, 'actorId' => $userId, ]]); } |