aboutsummaryrefslogtreecommitdiffstats
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-04 12:40:48 +0200
commitc1fdd9031ce8cf8e737e6091da723f3446c1b713 (patch)
tree136397f26a667a5afad78fd1aa8705a9b2ea0d26 /apps/files
parent6dab523afc73fcd1971b69b737c895b384f2bf3d (diff)
downloadnextcloud-server-c1fdd9031ce8cf8e737e6091da723f3446c1b713.tar.gz
nextcloud-server-c1fdd9031ce8cf8e737e6091da723f3446c1b713.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 b083ac44fa0..13ce76bbb2f 100644
--- a/apps/files/src/views/Sidebar.vue
+++ b/apps/files/src/views/Sidebar.vue
@@ -89,7 +89,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'
@@ -289,10 +289,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)
},
@@ -494,6 +497,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.