diff options
author | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 12:16:10 +0200 |
---|---|---|
committer | Thomas Müller <thomas.mueller@tmit.eu> | 2015-10-02 12:16:10 +0200 |
commit | 2912d0e3e32e81978f5f56ba3ae69d08621e1e6c (patch) | |
tree | 864f20298493174ea7e651f89031bc76c6b91489 | |
parent | f9093688cc12f97136f164166313573ea22cfc31 (diff) | |
parent | b6114ba2b6fc7c7f40478c1fcde5fa4cae5bf726 (diff) | |
download | nextcloud-server-2912d0e3e32e81978f5f56ba3ae69d08621e1e6c.tar.gz nextcloud-server-2912d0e3e32e81978f5f56ba3ae69d08621e1e6c.zip |
Merge pull request #19499 from owncloud/files-versions-properlyreloadafterrevert
Reload versions list after revert
-rw-r--r-- | apps/files_versions/js/versioncollection.js | 5 | ||||
-rw-r--r-- | apps/files_versions/js/versionstabview.js | 10 |
2 files changed, 13 insertions, 2 deletions
diff --git a/apps/files_versions/js/versioncollection.js b/apps/files_versions/js/versioncollection.js index 3f8214cde8c..176f8e7529c 100644 --- a/apps/files_versions/js/versioncollection.js +++ b/apps/files_versions/js/versioncollection.js @@ -67,6 +67,11 @@ return this.fetch({remove: false}); }, + reset: function() { + this._currentIndex = 0; + OC.Backbone.Collection.prototype.reset.apply(this, arguments); + }, + parse: function(result) { var results = _.map(result.data.versions, function(version) { var revision = parseInt(version.version, 10); diff --git a/apps/files_versions/js/versionstabview.js b/apps/files_versions/js/versionstabview.js index 55f24868196..f2b1c18bd37 100644 --- a/apps/files_versions/js/versionstabview.js +++ b/apps/files_versions/js/versionstabview.js @@ -85,12 +85,18 @@ ev.preventDefault(); revision = $target.attr('data-revision'); + this.$el.find('.versions, .showMoreVersions').addClass('hidden'); + var versionModel = this.collection.get(revision); versionModel.revert({ success: function() { // reset and re-fetch the updated collection + self.$versionsContainer.empty(); self.collection.setFileInfo(fileInfoModel); - self.collection.fetch(); + self.collection.reset([], {silent: true}); + self.collection.fetchNext(); + + self.$el.find('.versions').removeClass('hidden'); // update original model fileInfoModel.trigger('busy', fileInfoModel, false); @@ -157,7 +163,7 @@ if (fileInfo) { this.render(); this.collection.setFileInfo(fileInfo); - this.collection.reset({silent: true}); + this.collection.reset([], {silent: true}); this.nextPage(); } else { this.render(); |