diff --git a/lib/Db/TimelineQueryDay.php b/lib/Db/TimelineQueryDay.php index f602faa0..ae843c50 100644 --- a/lib/Db/TimelineQueryDay.php +++ b/lib/Db/TimelineQueryDay.php @@ -39,7 +39,8 @@ trait TimelineQueryDay { $whereFilecache ) { // Get all entries also present in filecache - $query->select('m.fileid', 'f.etag', 'm.isvideo', 'vco.categoryid') + $fileid = $query->createFunction('DISTINCT m.fileid'); + $query->select($fileid, 'f.etag', 'm.isvideo', 'vco.categoryid') ->from('memories', 'm') ->innerJoin('m', 'filecache', 'f', $query->expr()->andX( @@ -51,11 +52,6 @@ trait TimelineQueryDay { // Add favorite field $this->addFavoriteTag($query, $user); - // Get distinct fileids only - // This is required when browsing a folder in external storage - // since the same file can be present for multiple users - $query->groupBy('m.fileid'); - // Group and sort by date taken $query->orderBy('m.datetaken', 'DESC'); return $query;