diff --git a/lib/Album/AlbumMapper.php b/lib/Album/AlbumMapper.php index 8cb7b6bbb..66360a114 100644 --- a/lib/Album/AlbumMapper.php +++ b/lib/Album/AlbumMapper.php @@ -467,7 +467,7 @@ public function getAlbumsForCollaboratorIdAndFileId(string $collaboratorId, int ->leftJoin("a", "photos_albums_files", "p", $query->expr()->eq("a.album_id", "p.album_id")) ->where($query->expr()->eq('collaborator_id', $query->createNamedParameter($collaboratorId))) ->andWhere($query->expr()->eq('collaborator_type', $query->createNamedParameter($collaboratorType, IQueryBuilder::PARAM_INT))) - ->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId))) + ->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT))) ->groupBy('a.album_id') ->executeQuery() ->fetchAll(); diff --git a/lib/Controller/PreviewController.php b/lib/Controller/PreviewController.php index d84ea8797..2ad4e91ad 100644 --- a/lib/Controller/PreviewController.php +++ b/lib/Controller/PreviewController.php @@ -101,7 +101,7 @@ public function index( if (\count($nodes) === 0) { $receivedAlbums = $this->albumMapper->getAlbumsForCollaboratorIdAndFileId($user->getUID(), AlbumMapper::TYPE_USER, $fileId); - $receivedAlbums = array_udiff($checkedAlbums, $receivedAlbums, fn ($a, $b) => strcmp($a->getId(), $b->getId())); + $receivedAlbums = array_udiff($receivedAlbums, $checkedAlbums, fn ($a, $b) => strcmp($a->getId(), $b->getId())); $nodes = $this->getFileIdForAlbums($fileId, $receivedAlbums); $checkedAlbums = array_merge($checkedAlbums, $receivedAlbums); } @@ -110,7 +110,7 @@ public function index( $userGroups = $this->groupManager->getUserGroupIds($user); foreach ($userGroups as $groupId) { $albumsForGroup = $this->albumMapper->getAlbumsForCollaboratorIdAndFileId($groupId, AlbumMapper::TYPE_GROUP, $fileId); - $albumsForGroup = array_udiff($checkedAlbums, $albumsForGroup, fn ($a, $b) => strcmp($a->getId(), $b->getId())); + $albumsForGroup = array_udiff($albumsForGroup, $checkedAlbums, fn ($a, $b) => strcmp($a->getId(), $b->getId())); $nodes = $this->getFileIdForAlbums($fileId, $albumsForGroup); $checkedAlbums = array_merge($checkedAlbums, $receivedAlbums); if (\count($nodes) !== 0) {