diff options
author | Vincent Petry <vincent@nextcloud.com> | 2022-01-12 14:41:50 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-12 14:41:50 +0100 |
commit | db9fbc93072049b8816a683ca015ba53976db03a (patch) | |
tree | 0dbbe4f6a612ee661f853ecc6f7d3ca14dddba83 /apps/files/js/filelist.js | |
parent | 0d0fcd316a6b556cabf656cd7bdca63da26aab2d (diff) | |
parent | 809e3054448d952124811877c1a944f0446c79c1 (diff) | |
download | nextcloud-server-db9fbc93072049b8816a683ca015ba53976db03a.tar.gz nextcloud-server-db9fbc93072049b8816a683ca015ba53976db03a.zip |
Merge pull request #30593 from nextcloud/bugfix/19048/fix-changedirectory-recommendations
Trigger "changeDirectory" event on URL change
Diffstat (limited to 'apps/files/js/filelist.js')
-rw-r--r-- | apps/files/js/filelist.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/apps/files/js/filelist.js b/apps/files/js/filelist.js index 6fe9895c60e..a653aac25b9 100644 --- a/apps/files/js/filelist.js +++ b/apps/files/js/filelist.js @@ -794,7 +794,7 @@ if( (this._currentDirectory || this.$el.find('#dir').val()) && currentDir === e.dir) { return; } - this.changeDirectory(e.dir, false, true); + this.changeDirectory(e.dir, true, true, undefined, true); } }, @@ -2057,15 +2057,16 @@ * @param {boolean} [changeUrl=true] if the URL must not be changed (defaults to true) * @param {boolean} [force=false] set to true to force changing directory * @param {string} [fileId] optional file id, if known, to be appended in the URL + * @param {bool} [changedThroughUrl=false] true if the dir was set through a URL change */ - changeDirectory: function(targetDir, changeUrl, force, fileId) { + changeDirectory: function(targetDir, changeUrl, force, fileId, changedThroughUrl) { var self = this; var currentDir = this.getCurrentDirectory(); targetDir = targetDir || '/'; if (!force && currentDir === targetDir) { return; } - this._setCurrentDir(targetDir, changeUrl, fileId); + this._setCurrentDir(targetDir, changeUrl, fileId, changedThroughUrl); // discard finished uploads list, we'll get it through a regular reload this._uploads = {}; @@ -2100,8 +2101,9 @@ * @param targetDir directory to display * @param changeUrl true to also update the URL, false otherwise (default) * @param {string} [fileId] file id + * @param {bool} changedThroughUrl true if the dir was set through a URL change */ - _setCurrentDir: function(targetDir, changeUrl, fileId) { + _setCurrentDir: function(targetDir, changeUrl, fileId, changedThroughUrl) { targetDir = targetDir.replace(/\\/g, '/'); if (!this._isValidPath(targetDir)) { targetDir = '/'; @@ -2133,6 +2135,7 @@ if (fileId) { params.fileId = fileId; } + params.changedThroughUrl = changedThroughUrl this.$el.trigger(jQuery.Event('changeDirectory', params)); } this.breadcrumb.setDirectory(this.getCurrentDirectory()); @@ -2234,7 +2237,7 @@ if (status === 401) { // We are not authentificated, so reload the page so that we get // redirected to the login page while saving the current url. - location.reload(); + location.reload(); } // Firewall Blocked request? |