diff options
Diffstat (limited to 'apps/files/src/actions')
-rw-r--r-- | apps/files/src/actions/sidebarAction.spec.ts | 4 | ||||
-rw-r--r-- | apps/files/src/actions/sidebarAction.ts | 9 |
2 files changed, 9 insertions, 4 deletions
diff --git a/apps/files/src/actions/sidebarAction.spec.ts b/apps/files/src/actions/sidebarAction.spec.ts index 1f1e81dbeaf..75ed8c97b47 100644 --- a/apps/files/src/actions/sidebarAction.spec.ts +++ b/apps/files/src/actions/sidebarAction.spec.ts @@ -130,7 +130,7 @@ describe('Open sidebar action exec tests', () => { expect(goToRouteMock).toBeCalledWith( null, { view: view.id, fileid: '1' }, - { dir: '/' }, + { dir: '/', opendetails: 'true' }, true, ) }) @@ -159,7 +159,7 @@ describe('Open sidebar action exec tests', () => { expect(goToRouteMock).toBeCalledWith( null, { view: view.id, fileid: '1' }, - { dir: '/' }, + { dir: '/', opendetails: 'true' }, true, ) }) diff --git a/apps/files/src/actions/sidebarAction.ts b/apps/files/src/actions/sidebarAction.ts index a951de1db97..0b8ad91741e 100644 --- a/apps/files/src/actions/sidebarAction.ts +++ b/apps/files/src/actions/sidebarAction.ts @@ -44,6 +44,11 @@ export const action = new FileAction({ async exec(node: Node, view: View, dir: string) { try { + // If the sidebar is already open for the current file, do nothing + if (window.OCA.Files.Sidebar.file === node.path) { + logger.debug('Sidebar already open for this file', { node }) + return null + } // Open sidebar and set active tab to sharing by default window.OCA.Files.Sidebar.setActiveTab('sharing') @@ -51,10 +56,10 @@ export const action = new FileAction({ await window.OCA.Files.Sidebar.open(node.path) // Silently update current fileid - window.OCP.Files.Router.goToRoute( + window.OCP?.Files?.Router?.goToRoute( null, { view: view.id, fileid: String(node.fileid) }, - { ...window.OCP.Files.Router.query, dir }, + { ...window.OCP.Files.Router.query, dir, opendetails: 'true' }, true, ) |