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:
Thomas Müller 2014-02-26 14:42:31 +01:00
commit 4b8717df9d
1 changed files with 6 additions and 6 deletions

View File

@ -172,12 +172,12 @@ class Api {
// workaround because folders are named 'dir' in this context
$itemType = $file['type'] === 'file' ? 'file' : 'folder';
$share = \OCP\Share::getItemShared($itemType, $file['fileid']);
$receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
if ($receivedFrom) {
$share['received_from'] = $receivedFrom['uid_owner'];
$share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
}
if ($share) {
if($share) {
$receivedFrom = \OCP\Share::getItemSharedWithBySource($itemType, $file['fileid']);
if ($receivedFrom) {
$share['received_from'] = $receivedFrom['uid_owner'];
$share['received_from_displayname'] = \OCP\User::getDisplayName($receivedFrom['uid_owner']);
}
$result = array_merge($result, $share);
}
}