tq: hide files in hidden folders (fix #825)

Signed-off-by: Varun Patil <radialapps@gmail.com>
pull/837/head
Varun Patil 2023-09-27 18:33:03 -07:00
parent 277f1789f5
commit 725c32cb4e
2 changed files with 11 additions and 3 deletions

View File

@ -4,6 +4,7 @@ All notable changes to this project will be documented in this file.
## [Unreleased] ## [Unreleased]
- **Breaking**: Files in hidden folders are now hidden in the timeline ([#825](https://github.com/pulsejet/memories/issues/825))
- **Feature**: Support showing full file path in sidebar ([#173](https://github.com/pulsejet/memories/issues/173)) - **Feature**: Support showing full file path in sidebar ([#173](https://github.com/pulsejet/memories/issues/173))
- **Feature**: View file in folder on clicking name in sidebar - **Feature**: View file in folder on clicking name in sidebar
- **Feature**: User can leave albums that are shared with them - **Feature**: User can leave albums that are shared with them

View File

@ -6,10 +6,17 @@ namespace OCA\Memories\Db;
trait TimelineQueryCTE trait TimelineQueryCTE
{ {
protected static function CTE_FOLDERS_ALL(bool $notArchive): string /**
* CTE to get all files recursively in the given top folders
* :topFolderIds - The top folders to get files from
*
* @param bool $noHidden Whether to filter out files in hidden folders
* If the top folder is hidden, the files in it will still be returned
*/
protected static function CTE_FOLDERS_ALL(bool $noHidden): string
{ {
// Whether to filter out the archive folder // Whether to filter out the archive folder
$CLS_ARCHIVE_JOIN = $notArchive ? "f.name <> '.archive'" : '1 = 1'; $CLS_HIDDEN_JOIN = $noHidden ? "f.name NOT LIKE '.%'" : '1 = 1';
// Filter out folder MIME types // Filter out folder MIME types
$CLS_MIME_FOLDER = "f.mimetype = (SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = 'httpd/unix-directory')"; $CLS_MIME_FOLDER = "f.mimetype = (SELECT `id` FROM `*PREFIX*mimetypes` WHERE `mimetype` = 'httpd/unix-directory')";
@ -43,7 +50,7 @@ trait TimelineQueryCTE
ON ( ON (
f.parent = c.fileid AND f.parent = c.fileid AND
{$CLS_MIME_FOLDER} AND {$CLS_MIME_FOLDER} AND
{$CLS_ARCHIVE_JOIN} {$CLS_HIDDEN_JOIN}
) )
WHERE ( WHERE (
{$CLS_NOMEDIA} {$CLS_NOMEDIA}