From 5a9c99e6ac53ec021bcd124c2b8664fe269a5168 Mon Sep 17 00:00:00 2001 From: Arthur Schiwon Date: Thu, 23 Nov 2017 17:51:56 +0100 Subject: recycle SharedFileInfo values in fileInfo fileInfo is composed of data from sharing, however additional data is pulled when sidebar opens, e.g. the size. Then, existing data is overwritten by data from the other source (files). The data points that would be lost are not dirty however and still used, so we keep them. Signed-off-by: Arthur Schiwon --- apps/files_sharing/js/sharedfilelist.js | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) (limited to 'apps/files_sharing') diff --git a/apps/files_sharing/js/sharedfilelist.js b/apps/files_sharing/js/sharedfilelist.js index ad6f70a6f1c..ad818d91413 100644 --- a/apps/files_sharing/js/sharedfilelist.js +++ b/apps/files_sharing/js/sharedfilelist.js @@ -153,6 +153,27 @@ // storage info like free space / used space }, + updateRow: function($tr, fileInfo, options) { + if(!fileInfo instanceof OCA.Sharing.SharedFileInfo) { + // recycle SharedFileInfo values if something tries to overwrite it + var oldModel = this.getModelForFile($tr); + + if(_.isUndefined(fileInfo.recipientData) && oldModel.recipientData) { + fileInfo.recipientData = oldModel.recipientData; + } + if(_.isUndefined(fileInfo.recipients) && oldModel.recipientData) { + fileInfo.recipientData = oldModel.recipientData; + } + if(_.isUndefined(fileInfo.shares) && oldModel.shares) { + fileInfo.shares = oldModel.shares; + } + if(_.isUndefined(fileInfo.shareOwner) && oldModel.shareOwner) { + fileInfo.shareOwner = oldModel.shareOwner; + } + } + OCA.Files.FileList.prototype._createRow.updateRow(this, arguments); + }, + reload: function() { this.showMask(); if (this._reloadCall) { @@ -225,7 +246,6 @@ }, _makeFilesFromRemoteShares: function(data) { - var self = this; var files = data; files = _.chain(files) -- cgit v1.2.3