summaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-04-17 17:03:21 +0200
committerFerdinand Thiessen <opensource@fthiessen.de>2024-06-10 17:48:09 +0200
commit3c74559e4ce81ba5b0427125c67c5d31c33c0376 (patch)
tree98cd10917f0babce1b3ab20309d23a1f6a167126 /apps/files
parentc750ed66a72d48df7e73784b1a2225d7c50eae2c (diff)
downloadnextcloud-server-3c74559e4ce81ba5b0427125c67c5d31c33c0376.tar.gz
nextcloud-server-3c74559e4ce81ba5b0427125c67c5d31c33c0376.zip
fix(files): Close sidebar if shown node is deleted
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/src/views/Sidebar.vue15
1 files changed, 14 insertions, 1 deletions
diff --git a/apps/files/src/views/Sidebar.vue b/apps/files/src/views/Sidebar.vue
index e174dee7756..3b79cda260c 100644
--- a/apps/files/src/views/Sidebar.vue
+++ b/apps/files/src/views/Sidebar.vue
@@ -105,7 +105,7 @@
import { getCurrentUser } from '@nextcloud/auth'
import { getCapabilities } from '@nextcloud/capabilities'
import { showError } from '@nextcloud/dialogs'
-import { emit } from '@nextcloud/event-bus'
+import { emit, subscribe, unsubscribe } from '@nextcloud/event-bus'
import { File, Folder, formatFileSize } from '@nextcloud/files'
import { encodePath } from '@nextcloud/paths'
import { generateRemoteUrl, generateUrl } from '@nextcloud/router'
@@ -304,10 +304,13 @@ export default {
},
},
created() {
+ subscribe('files:node:deleted', this.onNodeDeleted)
+
window.addEventListener('resize', this.handleWindowResize)
this.handleWindowResize()
},
beforeDestroy() {
+ unsubscribe('file:node:deleted', this.onNodeDeleted)
window.removeEventListener('resize', this.handleWindowResize)
},
@@ -508,6 +511,16 @@ export default {
},
/**
+ * Handle if the current node was deleted
+ * @param {import('@nextcloud/files').Node} node The deleted node
+ */
+ onNodeDeleted(node) {
+ if (this.fileInfo && node && this.fileInfo.id === node.fileid) {
+ this.close()
+ }
+ },
+
+ /**
* Allow to set the Sidebar as fullscreen from OCA.Files.Sidebar
*
* @param {boolean} isFullScreen - Whether or not to render the Sidebar in fullscreen.