Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stable29] fix: Open Viewer when clicking on photo in folder #2433

Merged
merged 2 commits into from
Apr 17, 2024
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
4 changes: 2 additions & 2 deletions js/photos-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-main.js.map

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-public.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-public.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions js/photos-src_views_Folders_vue.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion js/photos-src_views_Folders_vue.js.map

Large diffs are not rendered by default.

25 changes: 24 additions & 1 deletion lib/Controller/AlbumsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -109,14 +110,36 @@ 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),
];
}

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();

Expand Down
3 changes: 2 additions & 1 deletion src/views/AlbumContent.vue
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@
<script>
import { mapActions } from 'vuex'

import { Folder, addNewFileMenuEntry, removeNewFileMenuEntry } from '@nextcloud/files'
import { Folder, addNewFileMenuEntry, removeNewFileMenuEntry, davParsePermissions } from '@nextcloud/files'
import { getCurrentUser } from '@nextcloud/auth'
import { NcActions, NcActionButton, NcButton, NcDialog, NcModal, NcEmptyContent, NcActionSeparator, NcLoadingIcon, isMobile } from '@nextcloud/vue'
import { UploadPicker, getUploader } from '@nextcloud/upload'
Expand Down Expand Up @@ -315,6 +315,7 @@ export default {
...this.album,
owner: getCurrentUser()?.uid ?? '',
source: this.album?.source ?? '',
permissions: davParsePermissions(this.album.permissions),
})
},
},
Expand Down
3 changes: 2 additions & 1 deletion src/views/Folders.vue
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
<script>
import { mapGetters } from 'vuex'
import { Upload, UploadPicker, getUploader } from '@nextcloud/upload'
import { Folder as NcFolder } from '@nextcloud/files'
import { Folder as NcFolder, davParsePermissions } from '@nextcloud/files'
import { NcEmptyContent } from '@nextcloud/vue'
import VirtualGrid from 'vue-virtual-grid'

Expand Down Expand Up @@ -147,6 +147,7 @@ export default {
return new NcFolder({
...this.folder,
source: decodeURI(this.folder.source),
permissions: davParsePermissions(this.folder.permissions),
})
},
folderContent() {
Expand Down
Loading