Skip to content

Commit 2e26a23

Browse files
committed
Do not load the session in getParticipantByActor() as no caller needs it
Also fixes a problem with MariaDB ONLY_FULL_GROUP_BY and Oracle Signed-off-by: Joas Schilling <[email protected]>
1 parent c27a6b3 commit 2e26a23

File tree

6 files changed

+8
-25
lines changed

6 files changed

+8
-25
lines changed

lib/Chat/MessageParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ protected function setActor(Message $message): void {
9292
$displayName = $this->guestNames[$comment->getActorId()];
9393
} else {
9494
try {
95-
$participant = $message->getRoom()->getParticipantByActor(Attendee::ACTOR_GUESTS, $comment->getActorId(), false);
95+
$participant = $message->getRoom()->getParticipantByActor(Attendee::ACTOR_GUESTS, $comment->getActorId());
9696
$displayName = $participant->getAttendee()->getDisplayName();
9797
} catch (ParticipantNotFoundException $e) {
9898
}

lib/Chat/Parser/SystemMessage.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -700,7 +700,7 @@ protected function getGuest(Room $room, string $actorId): array {
700700

701701
protected function getGuestName(Room $room, string $actorId): string {
702702
try {
703-
$participant = $room->getParticipantByActor(Attendee::ACTOR_GUESTS, $actorId, false);
703+
$participant = $room->getParticipantByActor(Attendee::ACTOR_GUESTS, $actorId);
704704
$name = $participant->getAttendee()->getDisplayName();
705705
if ($name === '') {
706706
return $this->l->t('Guest');

lib/Chat/Parser/UserMention.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public function parseMessage(Message $chatMessage): void {
132132
];
133133
} elseif ($mention['type'] === 'guest') {
134134
try {
135-
$participant = $chatMessage->getRoom()->getParticipantByActor(Attendee::ACTOR_GUESTS, substr($mention['id'], strlen('guest/')), false);
135+
$participant = $chatMessage->getRoom()->getParticipantByActor(Attendee::ACTOR_GUESTS, substr($mention['id'], strlen('guest/')));
136136
$displayName = $participant->getAttendee()->getDisplayName() ?: $this->l->t('Guest');
137137
} catch (ParticipantNotFoundException $e) {
138138
$displayName = $this->l->t('Guest');

lib/Controller/SignalingController.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -601,14 +601,14 @@ private function backendRoom(array $roomRequest): DataResponse {
601601
// If the user joins the session might not be known to the server yet.
602602
// In this case we load by actor information and use the session id as new session.
603603
try {
604-
$participant = $room->getParticipantByActor($actorType, $actorId, false);
604+
$participant = $room->getParticipantByActor($actorType, $actorId);
605605
} catch (ParticipantNotFoundException $e) {
606606
}
607607
}
608608
}
609609
} else {
610610
try {
611-
$participant = $room->getParticipantByActor($actorType, $actorId, false);
611+
$participant = $room->getParticipantByActor($actorType, $actorId);
612612
} catch (ParticipantNotFoundException $e) {
613613
}
614614
}

lib/Notification/Notifier.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -516,7 +516,7 @@ protected function parseChatMessage(INotification $notification, Room $room, Par
516516
* @throws ParticipantNotFoundException
517517
*/
518518
protected function getGuestParameter(Room $room, string $actorId): array {
519-
$participant = $room->getParticipantByActor(Attendee::ACTOR_GUESTS, $actorId, false);
519+
$participant = $room->getParticipantByActor(Attendee::ACTOR_GUESTS, $actorId);
520520
$name = $participant->getAttendee()->getDisplayName();
521521
if (trim($name) === '') {
522522
throw new ParticipantNotFoundException('Empty name');

lib/Room.php

Lines changed: 2 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -593,15 +593,12 @@ public function getParticipantByAttendeeId(int $attendeeId): Participant {
593593
/**
594594
* @param string $actorType
595595
* @param string $actorId
596-
* @param string|null|false $sessionId Set to false if you don't want to load a session (and save resources),
597-
* string to try loading a specific session
598-
* null to try loading "any"
599596
* @return Participant
600597
* @throws ParticipantNotFoundException When the pin is not valid (has no participant assigned)
601598
*/
602-
public function getParticipantByActor(string $actorType, string $actorId, $sessionId = null): Participant {
599+
public function getParticipantByActor(string $actorType, string $actorId): Participant {
603600
if ($actorType === Attendee::ACTOR_USERS) {
604-
return $this->getParticipant($actorId, $sessionId);
601+
return $this->getParticipant($actorId, false);
605602
}
606603

607604
$query = $this->db->getQueryBuilder();
@@ -613,20 +610,6 @@ public function getParticipantByActor(string $actorType, string $actorId, $sessi
613610
->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
614611
->setMaxResults(1);
615612

616-
if ($sessionId !== false) {
617-
if ($sessionId !== null) {
618-
$helper->selectSessionsTable($query);
619-
$query->leftJoin('a', 'talk_sessions', 's', $query->expr()->andX(
620-
$query->expr()->eq('s.session_id', $query->createNamedParameter($sessionId)),
621-
$query->expr()->eq('a.id', 's.attendee_id')
622-
));
623-
} else {
624-
$helper->selectSessionsTableMax($query);
625-
$query->groupBy('a.id');
626-
$query->leftJoin('a', 'talk_sessions', 's', $query->expr()->eq('a.id', 's.attendee_id'));
627-
}
628-
}
629-
630613
$result = $query->executeQuery();
631614
$row = $result->fetch();
632615
$result->closeCursor();

0 commit comments

Comments
 (0)