Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions apps/files/js/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 })
},

/**
Expand Down
7 changes: 0 additions & 7 deletions apps/files/js/filelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -762,13 +762,6 @@
*/
_onShow: function(e) {
OCA.Files.App && OCA.Files.App.updateCurrentFileList(this);
if (e.itemId === this.id) {
this._setCurrentDir('/', false);
}
// Only reload if we don't navigate to a different directory
if (typeof e.dir === 'undefined' || e.dir === this.getCurrentDirectory()) {
this.reload();
}
},

/**
Expand Down
12 changes: 8 additions & 4 deletions apps/files/src/views/Navigation.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}
},

Expand Down
4 changes: 2 additions & 2 deletions dist/files-main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/files-main.js.map

Large diffs are not rendered by default.