Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix share dialog sidebar in share views #10700

Merged
merged 3 commits into from
Aug 20, 2018
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
25 changes: 4 additions & 21 deletions apps/files_sharing/js/sharedfilelist.js
Original file line number Diff line number Diff line change
Expand Up @@ -166,24 +166,7 @@
},

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);
// no-op, suppress re-rendering
},

reload: function() {
Expand Down Expand Up @@ -328,11 +311,11 @@
* Converts the OCS API share response data to a file info
* list
* @param {Array} data OCS API share array
* @param {bool} sharedWithUser
* @return {Array.<OCA.Sharing.SharedFileInfo>} array of shared file info
*/
_makeFilesFromShares: function(data, sharedWithUser) {
/* jshint camelcase: false */
var self = this;
var files = data;

if (this._linksOnly) {
Expand Down Expand Up @@ -447,8 +430,8 @@
// array of sorted names
data.mountType = 'shared';
delete data.recipientsCount;
if (self._sharedWithUser) {
// only for outgoing shres
if (sharedWithUser) {
// only for outgoing shares
delete data.shareTypes;
} else {
data.shareTypes = _.keys(data.shareTypes);
Expand Down
2 changes: 1 addition & 1 deletion core/js/shareitemmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -777,7 +777,7 @@
return {};
}

var permissions = this.get('possiblePermissions');
var permissions = this.fileInfoModel.get('permissions');
if(!_.isUndefined(data.reshare) && !_.isUndefined(data.reshare.permissions) && data.reshare.uid_owner !== OC.currentUser) {
permissions = permissions & data.reshare.permissions;
}
Expand Down
2 changes: 1 addition & 1 deletion core/js/tests/specs/shareitemmodelSpec.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ describe('OC.Share.ShareItemModel', function() {
}]));
fetchSharesDeferred.resolve(makeOcsResponse([]));

model.set('possiblePermissions', OC.PERMISSION_READ);
model.fileInfoModel.set('permissions', OC.PERMISSION_READ);
model.fetch();

// no resharing allowed
Expand Down