diff options
author | Louis Chemineau <louis@chmn.me> | 2022-10-19 17:40:45 +0300 |
---|---|---|
committer | Louis Chemineau <louis@chmn.me> | 2022-10-20 15:30:48 +0300 |
commit | 576508c8ffa7a4ae7261c69c08c2157baf0e9f8d (patch) | |
tree | d2f4314ac54e345f38dbc2104b4203d94d45ac1b | |
parent | 3633b84fb54d702c7c4443589c2e586e264ad9aa (diff) |
Fix logic of share album content fetching
Signed-off-by: Louis Chemineau <louis@chmn.me>
-rw-r--r-- | lib/Album/AlbumMapper.php | 2 | ||||
-rw-r--r-- | lib/Controller/PreviewController.php | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/lib/Album/AlbumMapper.php b/lib/Album/AlbumMapper.php index 8cb7b6bb..66360a11 100644 --- a/lib/Album/AlbumMapper.php +++ b/lib/Album/AlbumMapper.php @@ -467,7 +467,7 @@ class AlbumMapper { ->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 d84ea879..2ad4e91a 100644 --- a/lib/Controller/PreviewController.php +++ b/lib/Controller/PreviewController.php @@ -101,7 +101,7 @@ class PreviewController extends Controller { 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 @@ class PreviewController extends Controller { $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) { |