From a39ec7b011a2067c3d136bee6e595bc31ad70607 Mon Sep 17 00:00:00 2001 From: Christopher Ng Date: Tue, 16 Apr 2024 11:02:49 -0700 Subject: [PATCH] fix: Open Viewer when clicking on photo in folder Signed-off-by: Christopher Ng --- lib/Controller/AlbumsController.php | 25 ++++++++++++++++++++++++- src/views/AlbumContent.vue | 3 ++- src/views/Folders.vue | 3 ++- 3 files changed, 28 insertions(+), 3 deletions(-) diff --git a/lib/Controller/AlbumsController.php b/lib/Controller/AlbumsController.php index cf8b2bc50..6013da1ea 100644 --- a/lib/Controller/AlbumsController.php +++ b/lib/Controller/AlbumsController.php @@ -30,6 +30,7 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\JSONResponse; +use OCP\Constants; use OCP\Files\File; use OCP\Files\Folder; use OCP\Files\IRootFolder; @@ -109,7 +110,7 @@ private function formatData(iterable $nodes): array { 'mime' => $node->getMimetype(), 'size' => $node->getSize(), 'type' => $node->getType(), - 'permissions' => $node->getPermissions(), + 'permissions' => $this->formatPermissions($node->getPermissions()), 'hasPreview' => $this->previewManager->isAvailable($node), ]; } @@ -117,6 +118,28 @@ private function formatData(iterable $nodes): array { return $result; } + private function formatPermissions(int $permissions): string { + $strPermissions = ''; + if ($permissions) { + if ($permissions & Constants::PERMISSION_CREATE) { + $strPermissions .= 'CK'; + } + if ($permissions & Constants::PERMISSION_READ) { + $strPermissions .= 'G'; + } + if ($permissions & Constants::PERMISSION_UPDATE) { + $strPermissions .= 'W'; + } + if ($permissions & Constants::PERMISSION_DELETE) { + $strPermissions .= 'D'; + } + if ($permissions & Constants::PERMISSION_SHARE) { + $strPermissions .= 'R'; + } + } + return $strPermissions; + } + private function scanCurrentFolder(Folder $folder, bool $shared): iterable { $nodes = $folder->getDirectoryListing(); diff --git a/src/views/AlbumContent.vue b/src/views/AlbumContent.vue index 8302d2fb9..06f3ceaff 100644 --- a/src/views/AlbumContent.vue +++ b/src/views/AlbumContent.vue @@ -165,7 +165,7 @@