Skip to content

Commit

Permalink
Show 'shared via' in share list for reshares
Browse files Browse the repository at this point in the history
Fixes #1330

userA shares a file to userB
userB shares that file to userC

userA can see both userB and userC.
Now they can also see that userB shared it to user C

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
  • Loading branch information
rullzer committed Apr 11, 2017
1 parent 1858039 commit 58f9598
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
13 changes: 13 additions & 0 deletions core/js/sharedialogshareelistview.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,8 @@
var shareWithDisplayName = this.model.getShareWithDisplayName(shareIndex);
var shareWithTitle = '';
var shareType = this.model.getShareType(shareIndex);
var sharedBy = this.model.getSharedBy(shareIndex);
var sharedByDisplayName = this.model.getSharedByDisplayName(shareIndex);

var hasPermissionOverride = {};
if (shareType === OC.Share.SHARE_TYPE_GROUP) {
Expand All @@ -211,6 +213,17 @@
shareWithTitle = shareWith;
}

if (sharedBy !== oc_current_user) {
var empty = shareWithTitle === '';
if (!empty) {
shareWithTitle += ' (';
}
shareWithTitle += t('core', 'shared by {sharer}', {sharer: sharedByDisplayName});
if (!empty) {
shareWithTitle += ')';
}
}

var share = this.model.get('shares')[shareIndex];
var password = share.password;
var hasPassword = password !== null && password !== '';
Expand Down
27 changes: 27 additions & 0 deletions core/js/shareitemmodel.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@
* @property {Date} expiration optional?
* @property {number} stime optional?
* @property {string} uid_owner
* @property {string} displayname_owner
*/

/**
Expand Down Expand Up @@ -407,6 +408,32 @@
return share.share_with_displayname;
},

/**
* @param shareIndex
* @returns {string}
*/
getSharedBy: function(shareIndex) {
/** @type OC.Share.Types.ShareInfo **/
var share = this.get('shares')[shareIndex];
if(!_.isObject(share)) {
throw "Unknown Share";
}
return share.uid_owner;
},

/**
* @param shareIndex
* @returns {string}
*/
getSharedByDisplayName: function(shareIndex) {
/** @type OC.Share.Types.ShareInfo **/
var share = this.get('shares')[shareIndex];
if(!_.isObject(share)) {
throw "Unknown Share";
}
return share.displayname_owner;
},

/**
* returns the array index of a sharee for a provided shareId
*
Expand Down

0 comments on commit 58f9598

Please sign in to comment.