Display link reshares

* No longer filterout all other link shares
* Display link shares in shareelist (below normal shares)

Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
This commit is contained in:
Roeland Jago Douma 2016-08-28 20:59:12 +02:00
parent 2dcd97bf14
commit 8d1e6eb9b2
No known key found for this signature in database
GPG Key ID: 1E152838F164D13B
2 changed files with 46 additions and 4 deletions

View File

@ -81,7 +81,15 @@
'</span>' +
'</li>' +
'{{/each}}' +
'</ul>';
'{{#each linkReshares}}' +
'<li data-share-id="{{shareId}}" data-share-type="{{shareType}}">' +
'<span class="icon icon-public"></span>' +
'<span class="has-tooltip username" title="{{shareInitiator}}">{{shareInitiatorDisplayName}}</span>' +
'<a href="#" class="unshare"><span class="icon-loading-small hidden"></span><span class="icon icon-delete"></span><span class="hidden-visually">{{unshareLabel}}</span></a>' +
'</li>' +
'{{/each}}' +
'</ul>'
;
/**
* @class OCA.Share.ShareDialogShareeListView
@ -192,9 +200,42 @@
var shares = this.model.get('shares');
var list = [];
for(var index = 0; index < shares.length; index++) {
var share = this.getShareeObject(index);
if (share.shareType === OC.Share.SHARE_TYPE_LINK) {
continue;
}
// first empty {} is necessary, otherwise we get in trouble
// with references
list.push(_.extend({}, universal, this.getShareeObject(index)));
list.push(_.extend({}, universal, share));
}
return list;
},
getLinkReshares: function() {
var universal = {
unshareLabel: t('core', 'Unshare'),
};
if(!this.model.hasUserShares()) {
return [];
}
var shares = this.model.get('shares');
var list = [];
for(var index = 0; index < shares.length; index++) {
var share = this.getShareeObject(index);
if (share.shareType !== OC.Share.SHARE_TYPE_LINK) {
continue;
}
// first empty {} is necessary, otherwise we get in trouble
// with references
list.push(_.extend({}, universal, share, {
shareInitiator: shares[index].uid_owner,
shareInitiatorDisplayName: shares[index].displayname_owner
}));
}
return list;
@ -203,7 +244,8 @@
render: function() {
this.$el.html(this.template({
cid: this.cid,
sharees: this.getShareeList()
sharees: this.getShareeList(),
linkReshares: this.getLinkReshares()
}));
if(this.configModel.areAvatarsEnabled()) {

View File

@ -763,7 +763,7 @@
* FIXME: Find a way to display properly
*/
if (share.uid_owner !== OC.currentUser) {
return share;
return;
}
var link = window.location.protocol + '//' + window.location.host;