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 <blizzz@arthur-schiwon.de>
This commit is contained in:
Arthur Schiwon 2017-11-23 17:51:56 +01:00
parent b3b34c08d1
commit 5a9c99e6ac
No known key found for this signature in database
GPG key ID: 7424F1874854DF23
3 changed files with 22 additions and 6 deletions

View file

@ -553,9 +553,6 @@
actionsWidth += $(action).outerWidth();
});
// subtract app navigation toggle when visible
containerWidth -= $('#app-navigation-toggle').width();
this.breadcrumb._resize();
this.$table.find('>thead').width($('#app-content').width() - OC.Util.getScrollBarWidth());
@ -1369,7 +1366,7 @@
* @return new tr element (not appended to the table)
*/
add: function(fileData, options) {
var index = -1;
var index;
var $tr;
var $rows;
var $insertionPoint;

View file

@ -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)

View file

@ -161,7 +161,6 @@ OC.Share = _.extend(OC.Share || {}, {
updateIcon:function(itemType, itemSource) {
var shares = false;
var link = false;
var image = OC.imagePath('core', 'actions/share');
var iconClass = '';
$.each(OC.Share.itemShares, function(index) {
if (OC.Share.itemShares[index]) {