only add "received_from" if a share was found

This commit is contained in:
Bjoern Schiessle 2014-02-26 12:52:35 +01:00
Родитель 59df3ffdf4
Коммит 3be5e48b0c
1 изменённых файлов: 6 добавлений и 6 удалений

Просмотреть файл

@ -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);
}
}