diff --git a/apps/files/src/actions/openFolderAction.ts b/apps/files/src/actions/openFolderAction.ts index 9e832515976..c0e03b20af0 100644 --- a/apps/files/src/actions/openFolderAction.ts +++ b/apps/files/src/actions/openFolderAction.ts @@ -59,7 +59,7 @@ export const action = new FileAction({ window.OCP.Files.Router.goToRoute( null, - { fileid: undefined }, + { view: view.id, fileid: undefined }, { dir: join(dir, node.basename), fileid: undefined }, ) return null diff --git a/apps/files/src/actions/sidebarAction.ts b/apps/files/src/actions/sidebarAction.ts index 6c553d97902..0073d1c8490 100644 --- a/apps/files/src/actions/sidebarAction.ts +++ b/apps/files/src/actions/sidebarAction.ts @@ -19,9 +19,11 @@ * along with this program. If not, see . * */ +import type { Navigation } from '../services/Navigation' + +import { Permission, type Node } from '@nextcloud/files' import { translate as t } from '@nextcloud/l10n' import InformationSvg from '@mdi/svg/svg/information-variant.svg?raw' -import { Permission, type Node } from '@nextcloud/files' import { registerFileAction, FileAction } from '../services/FileAction' import logger from '../logger.js' @@ -48,11 +50,19 @@ export const action = new FileAction({ return (nodes[0].root?.startsWith('/files/') && nodes[0].permissions !== Permission.NONE) ?? false }, - async exec(node: Node) { + async exec(node: Node, view: Navigation) { try { // TODO: migrate Sidebar to use a Node instead window?.OCA?.Files?.Sidebar?.open?.(node.path) + // Silently update current fileid + window.OCP.Files.Router.goToRoute( + null, + { view: view.id, fileid: node.fileid }, + { dir: node.dirname }, + true, + ) + return null } catch (error) { logger.error('Error while opening sidebar', { error }) diff --git a/apps/files/src/actions/viewInFolderAction.ts b/apps/files/src/actions/viewInFolderAction.ts index 2f603e6cf3a..f0c5d2485a3 100644 --- a/apps/files/src/actions/viewInFolderAction.ts +++ b/apps/files/src/actions/viewInFolderAction.ts @@ -61,7 +61,7 @@ export const action = new FileAction({ window.OCP.Files.Router.goToRoute( null, { view: 'files', fileid: node.fileid }, - { dir: node.dirname, fileid: node.fileid }, + { dir: node.dirname }, ) return null }, diff --git a/apps/files/src/components/FileEntry.vue b/apps/files/src/components/FileEntry.vue index d189c83e63a..6495a84db30 100644 --- a/apps/files/src/components/FileEntry.vue +++ b/apps/files/src/components/FileEntry.vue @@ -377,7 +377,7 @@ export default Vue.extend({ return this.selectionStore.selected }, isSelected() { - return this.selectedFiles.includes(this.source?.fileid?.toString?.()) + return this.selectedFiles.includes(this.fileid) }, cropPreviews() { @@ -481,7 +481,7 @@ export default Vue.extend({ }, isActive() { - return this.fileid === this.currentFileId + return this.fileid === this.currentFileId?.toString?.() }, }, @@ -502,16 +502,6 @@ export default Vue.extend({ isRenaming() { this.startRenaming() }, - - /** - * Open the sidebar if the file is active - */ - isActive(active) { - const Sidebar = window?.OCA?.Files?.Sidebar - if (active && Sidebar && Sidebar.file !== this.source.path) { - Sidebar.open(this.source.path) - } - }, }, /** diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 18c58a6c41b..c943b899897 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -68,7 +68,7 @@