]> source.dussan.org Git - nextcloud-server.git/commitdiff
fix(files): add silent mode in legacy navigation
authorGrigorii K. Shartsev <me@shgk.me>
Mon, 30 Oct 2023 23:21:56 +0000 (00:21 +0100)
committerGrigorii K. Shartsev <me@shgk.me>
Wed, 1 Nov 2023 17:59:04 +0000 (18:59 +0100)
Signed-off-by: Grigorii K. Shartsev <me@shgk.me>
apps/files/js/app.js
apps/files/src/views/Navigation.vue

index ffa996d9f67b3f4581ca63155dd19affbb5012ae..45ff02d66a04706b273cb14df14a939d9365d320 100644 (file)
                /**
                 * 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 })
                },
 
                /**
index d9fdfa7fe02db3aa28ba6733eed4d0ab1a45e94e..3570801e830348d6917fd0ea6ca9eff9fdf283a7 100644 (file)
@@ -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)
+                               }
                        }
                },