Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/spreed.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2020-10-21 12:54:28 +0300
committerJoas Schilling <coding@schilljs.com>2020-10-30 12:38:09 +0300
commit9fed7b6760d3ecaa27337a86a4cd74e2f173d8a6 (patch)
tree9295812817ab424de0000ad84c9c51e84d5060f0 /lib/Room.php
parentf905186571c1041d410eb84501404156185bfc41 (diff)
Fix joining as a guest and leaving a conversation as a session
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'lib/Room.php')
-rw-r--r--lib/Room.php21
1 files changed, 15 insertions, 6 deletions
diff --git a/lib/Room.php b/lib/Room.php
index 824f2e9a7..c4b71f5df 100644
--- a/lib/Room.php
+++ b/lib/Room.php
@@ -353,9 +353,14 @@ class Room {
$query = $this->db->getQueryBuilder();
$query->select('*')
- ->from('talk_participants')
- ->where($query->expr()->eq('user_id', $query->createNamedParameter($userId)))
- ->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($this->getId())));
+ ->selectAlias('a.id', 'a_id')
+ ->selectAlias('s.id', 's_id')
+ ->from('talk_attendees', 'a')
+ ->leftJoin('a', 'talk_sessions', 's', $query->expr()->eq('a.id', 's.attendee_id'))
+ ->where($query->expr()->eq('a.actor_type', $query->createNamedParameter('users')))
+ ->andWhere($query->expr()->eq('a.actor_id', $query->createNamedParameter($userId)))
+ ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
+ ->setMaxResults(1);
$result = $query->execute();
$row = $result->fetch();
$result->closeCursor();
@@ -384,9 +389,13 @@ class Room {
$query = $this->db->getQueryBuilder();
$query->select('*')
- ->from('talk_participants')
- ->where($query->expr()->eq('session_id', $query->createNamedParameter($sessionId)))
- ->andWhere($query->expr()->eq('room_id', $query->createNamedParameter($this->getId())));
+ ->selectAlias('a.id', 'a_id')
+ ->selectAlias('s.id', 's_id')
+ ->from('talk_sessions', 's')
+ ->leftJoin('s', 'talk_attendees', 'a', $query->expr()->eq('a.id', 's.attendee_id'))
+ ->where($query->expr()->eq('s.session_id', $query->createNamedParameter($sessionId)))
+ ->andWhere($query->expr()->eq('a.room_id', $query->createNamedParameter($this->getId())))
+ ->setMaxResults(1);
$result = $query->execute();
$row = $result->fetch();
$result->closeCursor();