diff options
author | John Molakvoæ <skjnldsv@users.noreply.github.com> | 2023-09-27 08:53:04 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-09-27 08:53:04 +0200 |
commit | 6fb5f97abc63f1cf77921c6b4adb182b27793338 (patch) | |
tree | ffe919e4c9daabf3097eea0dc699c4e8da01c1bb /apps | |
parent | 5dcefad91fc52cad3061c697a2f35bd7d116b9f7 (diff) | |
parent | 8e9e222105455297fa7dda8abda8af2acf532c55 (diff) | |
download | nextcloud-server-6fb5f97abc63f1cf77921c6b4adb182b27793338.tar.gz nextcloud-server-6fb5f97abc63f1cf77921c6b4adb182b27793338.zip |
Merge pull request #40604 from nextcloud/fix/dnd/open-fileid
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/openFolderAction.spec.ts | 2 | ||||
-rw-r--r-- | apps/files/src/actions/openFolderAction.ts | 4 | ||||
-rw-r--r-- | apps/files/src/components/BreadCrumbs.vue | 3 | ||||
-rw-r--r-- | apps/files/src/components/FilesListVirtual.vue | 11 |
4 files changed, 13 insertions, 7 deletions
diff --git a/apps/files/src/actions/openFolderAction.spec.ts b/apps/files/src/actions/openFolderAction.spec.ts index 98497a22fdc..a7f31db94ab 100644 --- a/apps/files/src/actions/openFolderAction.spec.ts +++ b/apps/files/src/actions/openFolderAction.spec.ts @@ -131,7 +131,7 @@ describe('Open folder action execute tests', () => { // Silent action expect(exec).toBe(null) expect(goToRouteMock).toBeCalledTimes(1) - expect(goToRouteMock).toBeCalledWith(null, { fileid: undefined, view: 'files' }, { dir: '/FooBar' }) + expect(goToRouteMock).toBeCalledWith(null, { fileid: 1, view: 'files' }, { dir: '/FooBar' }) }) test('Open folder fails without node', async () => { diff --git a/apps/files/src/actions/openFolderAction.ts b/apps/files/src/actions/openFolderAction.ts index f802ea4ad6d..e6d8c7f7edf 100644 --- a/apps/files/src/actions/openFolderAction.ts +++ b/apps/files/src/actions/openFolderAction.ts @@ -56,8 +56,8 @@ export const action = new FileAction({ window.OCP.Files.Router.goToRoute( null, - { view: view.id, fileid: undefined }, - { dir: join(dir, node.basename), fileid: undefined }, + { view: view.id, fileid: node.fileid }, + { dir: join(dir, node.basename) }, ) return null }, diff --git a/apps/files/src/components/BreadCrumbs.vue b/apps/files/src/components/BreadCrumbs.vue index ec2041bf8ad..bed8f104e96 100644 --- a/apps/files/src/components/BreadCrumbs.vue +++ b/apps/files/src/components/BreadCrumbs.vue @@ -69,7 +69,8 @@ export default Vue.extend({ sections() { return this.dirs.map(dir => { - const to = { ...this.$route, query: { dir } } + const fileid = this.getFileIdFromPath(dir) + const to = { ...this.$route, params: { fileid }, query: { dir } } return { dir, exact: true, diff --git a/apps/files/src/components/FilesListVirtual.vue b/apps/files/src/components/FilesListVirtual.vue index 3bc773a614a..9a55b9cdde4 100644 --- a/apps/files/src/components/FilesListVirtual.vue +++ b/apps/files/src/components/FilesListVirtual.vue @@ -169,7 +169,7 @@ export default Vue.extend({ // Scroll to the file if it's in the url if (this.fileId) { const index = this.nodes.findIndex(node => node.fileid === this.fileId) - if (index === -1) { + if (index === -1 && this.fileId !== this.currentFolder.fileid) { showError(this.t('files', 'File not found')) } this.scrollToIndex = Math.max(0, index) @@ -177,8 +177,13 @@ export default Vue.extend({ // Open the file sidebar if we have the room for it if (document.documentElement.clientWidth > 1024) { - // Open the sidebar on the file if it's in the url and - // we're just loaded the app for the first time. + // Don't open the sidebar for the current folder + if (this.currentFolder.fileid === this.fileId) { + return + } + + // Open the sidebar for the given URL fileid + // iif we just loaded the app. const node = this.nodes.find(n => n.fileid === this.fileId) as Node if (node && sidebarAction?.enabled?.([node], this.currentView)) { logger.debug('Opening sidebar on file ' + node.path, { node }) |