mirror of
https://github.com/nextcloud/server.git
synced 2026-06-14 19:20:35 -04:00
fix(files): open folder fileid while navigating without opening the sidebar
Signed-off-by: John Molakvoæ <skjnldsv@protonmail.com>
This commit is contained in:
parent
912b18b1fc
commit
8e9e222105
8 changed files with 19 additions and 13 deletions
|
|
@ -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 () => {
|
||||
|
|
|
|||
|
|
@ -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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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 })
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
4
dist/files-main.js
vendored
4
dist/files-main.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-main.js.map
vendored
2
dist/files-main.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue