Don't display actions for children in shared collections, show the parent collection the child is shared in
This commit is contained in:
parent
13d513c17c
commit
6c17a4cb77
|
@ -71,7 +71,8 @@ OC.Share={
|
||||||
var item = itemSource;
|
var item = itemSource;
|
||||||
}
|
}
|
||||||
if (typeof OC.Share.statuses[item] === 'undefined') {
|
if (typeof OC.Share.statuses[item] === 'undefined') {
|
||||||
checkShares = false;
|
// NOTE: Check doesn't always work and misses some shares, fix later
|
||||||
|
checkShares = true;
|
||||||
} else {
|
} else {
|
||||||
checkShares = true;
|
checkShares = true;
|
||||||
}
|
}
|
||||||
|
@ -149,7 +150,11 @@ OC.Share={
|
||||||
if (share.share_type == OC.Share.SHARE_TYPE_LINK) {
|
if (share.share_type == OC.Share.SHARE_TYPE_LINK) {
|
||||||
OC.Share.showLink(itemSource, share.share_with);
|
OC.Share.showLink(itemSource, share.share_with);
|
||||||
} else {
|
} else {
|
||||||
OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions);
|
if (share.collection) {
|
||||||
|
OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, share.collection);
|
||||||
|
} else {
|
||||||
|
OC.Share.addShareWith(share.share_type, share.share_with, share.permissions, possiblePermissions, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -213,11 +218,25 @@ OC.Share={
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
addShareWith:function(shareType, shareWith, permissions, possiblePermissions) {
|
addShareWith:function(shareType, shareWith, permissions, possiblePermissions, collection) {
|
||||||
if (!OC.Share.itemShares[shareType]) {
|
if (!OC.Share.itemShares[shareType]) {
|
||||||
OC.Share.itemShares[shareType] = [];
|
OC.Share.itemShares[shareType] = [];
|
||||||
}
|
}
|
||||||
OC.Share.itemShares[shareType].push(shareWith);
|
OC.Share.itemShares[shareType].push(shareWith);
|
||||||
|
if (collection) {
|
||||||
|
if (collection.item_type == 'file' || collection.item_type == 'folder') {
|
||||||
|
var item = collection.path;
|
||||||
|
} else {
|
||||||
|
var item = collection.item_source;
|
||||||
|
}
|
||||||
|
var collectionList = $('#shareWithList li').filterAttr('data-collection', item);
|
||||||
|
if (collectionList.length > 0) {
|
||||||
|
$(collectionList).append(', '+shareWith);
|
||||||
|
} else {
|
||||||
|
var html = '<li style="clear: both;" data-collection="'+item+'">Shared in '+item+' with '+shareWith+'</li>';
|
||||||
|
$('#shareWithList').prepend(html);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = '';
|
var editChecked = createChecked = updateChecked = deleteChecked = shareChecked = '';
|
||||||
if (permissions & OC.PERMISSION_CREATE) {
|
if (permissions & OC.PERMISSION_CREATE) {
|
||||||
createChecked = 'checked="checked"';
|
createChecked = 'checked="checked"';
|
||||||
|
@ -262,7 +281,7 @@ OC.Share={
|
||||||
html += '</div>';
|
html += '</div>';
|
||||||
html += '</li>';
|
html += '</li>';
|
||||||
$(html).appendTo('#shareWithList');
|
$(html).appendTo('#shareWithList');
|
||||||
|
}
|
||||||
},
|
},
|
||||||
showLink:function(itemSource, password) {
|
showLink:function(itemSource, password) {
|
||||||
$('#linkCheckbox').attr('checked', true);
|
$('#linkCheckbox').attr('checked', true);
|
||||||
|
|
|
@ -695,7 +695,12 @@ class Share {
|
||||||
if (isset($item) && $row['item_type'] == $itemType && $row[$column] == $item) {
|
if (isset($item) && $row['item_type'] == $itemType && $row[$column] == $item) {
|
||||||
$collectionItems[] = $row;
|
$collectionItems[] = $row;
|
||||||
} else {
|
} else {
|
||||||
$row['collection'] = array('item_type' => $row['item_type'], $column => $row[$column]);
|
$collection = array();
|
||||||
|
$collection['item_type'] = $row['item_type'];
|
||||||
|
if ($row['item_type'] == 'file' || $row['item_type'] == 'folder') {
|
||||||
|
$collection['path'] = basename($row['path']);
|
||||||
|
}
|
||||||
|
$row['collection'] = $collection;
|
||||||
// Fetch all of the children sources
|
// Fetch all of the children sources
|
||||||
$children = $collectionBackend->getChildren($row[$column]);
|
$children = $collectionBackend->getChildren($row[$column]);
|
||||||
foreach ($children as $child) {
|
foreach ($children as $child) {
|
||||||
|
|
Loading…
Reference in New Issue