From ef07975012ce2ffd49c8bf04beb49e6459dba4bc Mon Sep 17 00:00:00 2001 From: "Grigorii K. Shartsev" Date: Tue, 31 Oct 2023 00:21:56 +0100 Subject: [PATCH] fix(files): add silent mode in legacy navigation Signed-off-by: Grigorii K. Shartsev --- apps/files/js/app.js | 6 ++++-- apps/files/src/views/Navigation.vue | 12 ++++++++---- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/apps/files/js/app.js b/apps/files/js/app.js index ffa996d9f67..45ff02d66a0 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -216,10 +216,12 @@ /** * Sets the currently active view * @param viewId view id + * @param {Object} options options + * @param {boolean} [options.silent=false] if true, the view will not be shown immediately */ - setActiveView: function(viewId) { + setActiveView: function (viewId, { silent = false } = {}) { // The Navigation API will handle the final event - window._nc_event_bus.emit('files:legacy-navigation:changed', { id: viewId }) + window._nc_event_bus.emit('files:legacy-navigation:changed', { id: viewId, silent }) }, /** diff --git a/apps/files/src/views/Navigation.vue b/apps/files/src/views/Navigation.vue index d9fdfa7fe02..3570801e830 100644 --- a/apps/files/src/views/Navigation.vue +++ b/apps/files/src/views/Navigation.vue @@ -200,16 +200,20 @@ export default { * Coming from the legacy files app. * TODO: remove when all views are migrated. * - * @param {Navigation} view the new active view + * @param {object} payload the payload + * @param {string} [payload.id='files'] the view id + * @param {boolean} [payload.silent=false] if true, the view will not be shown immediately */ - onLegacyNavigationChanged({ id } = { id: 'files' }) { + onLegacyNavigationChanged({ id = 'files', silent = false } = {}) { const view = this.Navigation.views.find(view => view.id === id) if (view && view.legacy && view.id !== this.currentView.id) { // Force update the current route as the request comes // from the legacy files app router this.$router.replace({ ...this.$route, params: { view: view.id } }) - this.Navigation.setActive(view) - this.showView(view) + if (!silent) { + this.Navigation.setActive(view) + this.showView(view) + } } }, -- 2.39.5