Skip to content

Commit

Permalink
Merge pull request #1408 from nextcloud/backport/stable25/1389
Browse files Browse the repository at this point in the history
[stable25] Fix logic of share album content fetching
  • Loading branch information
artonge authored Oct 20, 2022
2 parents f1973b9 + 576508c commit da098c1
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Album/AlbumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
4 changes: 2 additions & 2 deletions lib/Controller/PreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand All @@ -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) {
Expand Down

0 comments on commit da098c1

Please sign in to comment.