Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cypress/e2e/albumsUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function deleteAnAlbumFromAlbumContent(albumName: string) {
cy.contains('Delete album').click()
cy.contains(`Are you sure you want to delete ${albumName}? This action cannot be undone.`)
.parentsUntil('.modal')
.contains('Delete')
.contains('Confirm')
.click()
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Album/AlbumMapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,9 @@ public function getForAlbumIdAndFileId(int $albumId, int $fileId): ?AlbumFile {
->leftJoin('p', 'filecache', 'f', $query->expr()->eq('p.file_id', 'f.fileid'))
->where($query->expr()->eq('a.album_id', $query->createNamedParameter($albumId, IQueryBuilder::PARAM_INT)))
->andWhere($query->expr()->eq('file_id', $query->createNamedParameter($fileId, IQueryBuilder::PARAM_INT)));
$row = $query->executeQuery()->fetchAll()[0];
$row = $query->executeQuery()->fetch();

if ($row === null) {
if ($row === false) {
return null;
}

Expand Down
4 changes: 4 additions & 0 deletions lib/Controller/PreviewController.php
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ protected function getFileIdForAlbums(int $fileId, array $albums): array {
$albumFile = array_pop($albumFiles);
}

if ($albumFile === null) {
continue;
}

$nodes = $this->rootFolder
->getUserFolder($albumFile->getOwner())
->getById($fileId);
Expand Down
8 changes: 5 additions & 3 deletions lib/Filters/FiltersManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ public function registerFilter(IFilter $filter): void {
* @return AlbumFile[]
*/
public function getFilesBasedOnFilters(string $userId, array $userFilters, ?int $fileId = null): array {
$filtersOperations = [];

foreach ($userFilters as $filterId => $filterValue) {
if (is_array($filterValue) && count($filterValue) > 0) {
$filtersOperations[] = $this->registeredFilters[$filterId]->getSearchOperator($filterValue);
Expand All @@ -61,7 +63,7 @@ public function getFilesBasedOnFilters(string $userId, array $userFilters, ?int
);
}

$filtersOperations += $this->getPhotosDefaultSearchConditions();
array_push($filtersOperations, ...$this->getPhotosDefaultSearchConditions($userId));

$query = new SearchQuery(new SearchBinaryOperator(ISearchBinaryOperator::OPERATOR_AND, $filtersOperations), 1000, 0, []);

Expand All @@ -85,8 +87,8 @@ function ($file) use ($userId) {
);
}

private function getPhotosDefaultSearchConditions(): array {
$folders = json_decode($this->userConfigService->getUserConfig('photosSourceFolders'));
private function getPhotosDefaultSearchConditions(string $userId): array {
$folders = json_decode($this->userConfigService->getConfigForUser($userId, 'photosSourceFolders'));

return [
new SearchBinaryOperator(
Expand Down
Loading