diff options
-rw-r--r-- | apps/files/js/app.js | 6 | ||||
-rw-r--r-- | 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 d92d8f77287..1d1f87d5f5d 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -219,10 +219,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 e164880003a..d4dbb7899aa 100644 --- a/apps/files/src/views/Navigation.vue +++ b/apps/files/src/views/Navigation.vue @@ -228,16 +228,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) + } } }, |