diff options
Diffstat (limited to 'apps/files/js/app.js')
-rw-r--r-- | apps/files/js/app.js | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/apps/files/js/app.js b/apps/files/js/app.js index f0c3ac5c212..1252bd5796c 100644 --- a/apps/files/js/app.js +++ b/apps/files/js/app.js @@ -51,7 +51,6 @@ * Initializes the files app */ initialize: function() { - this.navigation = OCP.Files.Navigation; this.$showHiddenFiles = $('input#showhiddenfilesToggle'); var showHidden = $('#showHiddenFiles').val() === "1"; this.$showHiddenFiles.prop('checked', showHidden); @@ -117,7 +116,9 @@ }, ], sorting: { - mode: $('#defaultFileSorting').val(), + mode: $('#defaultFileSorting').val() === 'basename' + ? 'name' + : $('#defaultFileSorting').val(), direction: $('#defaultFileSortingDirection').val() }, config: this._filesConfig, @@ -135,8 +136,6 @@ OC.Plugins.attach('OCA.Files.App', this); this._setupEvents(); - // trigger URL change event handlers - this._onPopState({ ...OC.Util.History.parseUrlQuery(), view: this.navigation?.active?.id }); this._debouncedPersistShowHiddenFilesState = _.debounce(this._persistShowHiddenFilesState, 1200); this._debouncedPersistCropImagePreviewsState = _.debounce(this._persistCropImagePreviewsState, 1200); @@ -145,6 +144,10 @@ OCP.WhatsNew.query(); // for Nextcloud server sessionStorage.setItem('WhatsNewServerCheck', Date.now()); } + + window._nc_event_bus.emit('files:legacy-view:initialized', this); + + this.navigation = OCP.Files.Navigation }, /** @@ -225,7 +228,8 @@ * @return view id */ getActiveView: function() { - return this.navigation.active + return this.navigation + && this.navigation.active && this.navigation.active.id; }, @@ -314,7 +318,7 @@ view: 'files' }, params); - var lastId = this.navigation.active; + var lastId = this.getActiveView(); if (!this.navigation.views.find(view => view.id === params.view)) { params.view = 'files'; } |