diff options
author | Roeland Jago Douma <rullzer@users.noreply.github.com> | 2020-02-03 21:23:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-03 21:23:35 +0100 |
commit | 4503cff51a5a075291ac63d1ae5472ae49b97679 (patch) | |
tree | 8b971c64eb415f83b3bab90df55081073547e5c9 | |
parent | 906348ca145058c68f66237de487436575570a44 (diff) | |
parent | 4c7bd11fc8b2cba43d95cac6a2f9fde76ee4ea60 (diff) | |
download | nextcloud-server-4503cff51a5a075291ac63d1ae5472ae49b97679.tar.gz nextcloud-server-4503cff51a5a075291ac63d1ae5472ae49b97679.zip |
Merge pull request #19281 from nextcloud/fix/noid/get-unread-comments-with-indexes
for the DB ot pick an index specify the object_type
-rw-r--r-- | lib/private/Comments/Manager.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/private/Comments/Manager.php b/lib/private/Comments/Manager.php index a4be8b3e4b1..f1c72243597 100644 --- a/lib/private/Comments/Manager.php +++ b/lib/private/Comments/Manager.php @@ -601,11 +601,13 @@ class Manager implements ICommentsManager { $query = $qb->select('f.fileid') ->addSelect($qb->func()->count('c.id', 'num_ids')) ->from('filecache', 'f') - ->leftJoin('f', 'comments', 'c', $qb->expr()->eq( - 'f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT) + ->leftJoin('f', 'comments', 'c', $qb->expr()->andX( + $qb->expr()->eq('f.fileid', $qb->expr()->castColumn('c.object_id', IQueryBuilder::PARAM_INT)), + $qb->expr()->eq('c.object_type', $qb->createNamedParameter('files')) )) - ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->eq( - 'c.object_id', 'm.object_id' + ->leftJoin('c', 'comments_read_markers', 'm', $qb->expr()->andX( + $qb->expr()->eq('c.object_id', 'm.object_id'), + $qb->expr()->eq('m.object_type', $qb->createNamedParameter('files')) )) ->where( $qb->expr()->andX( |