Merge pull request #7416 from owncloud/share_api_7311
[share api] only add "received_from" field if a share was found
This commit is contained in:
commit
4b8717df9d
|
@ -172,12 +172,12 @@ class Api {
|
||||||
// workaround because folders are named 'dir' in this context
|
// workaround because folders are named 'dir' in this context
|
||||||
$itemType = $file['type'] === 'file' ? 'file' : 'folder';
|
$itemType = $file['type'] === 'file' ? 'file' : 'folder';
|
||||||
$share = \OCP\Share::getItemShared($itemType, $file['fileid']);
|
$share = \OCP\Share::getItemShared($itemType, $file['fileid']);
|
||||||
|
if($share) {
|
||||||
$receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
|
$receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
|
||||||
if ($receivedFrom) {
|
if ($receivedFrom) {
|
||||||
$share['received_from'] = $receivedFrom['uid_owner'];
|
$share['received_from'] = $receivedFrom['uid_owner'];
|
||||||
$share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
|
$share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
|
||||||
}
|
}
|
||||||
if ($share) {
|
|
||||||
$result = array_merge($result, $share);
|
$result = array_merge($result, $share);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue