diff options
Diffstat (limited to 'lib/private/share')
-rw-r--r-- | lib/private/share/share.php | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/lib/private/share/share.php b/lib/private/share/share.php index d8c09bb0883..fd24fc686b1 100644 --- a/lib/private/share/share.php +++ b/lib/private/share/share.php @@ -1222,7 +1222,7 @@ class Share extends Constants { $qb->update('`*PREFIX*share`') ->set('`share_with`', ':pass') ->where('`id` = :shareId') - ->setParameter(':pass', is_null($password) ? 'NULL' : \OC::$server->getHasher()->hash($password)) + ->setParameter(':pass', is_null($password) ? null : \OC::$server->getHasher()->hash($password)) ->setParameter(':shareId', $shareId); $qb->execute(); @@ -1705,11 +1705,20 @@ class Share extends Constants { $row['permissions'] &= ~\OCP\Constants::PERMISSION_SHARE; } // Add display names to result + $row['share_with_displayname'] = $row['share_with']; if ( isset($row['share_with']) && $row['share_with'] != '' && - isset($row['share_with']) && $row['share_type'] === self::SHARE_TYPE_USER) { + $row['share_type'] === self::SHARE_TYPE_USER) { $row['share_with_displayname'] = \OCP\User::getDisplayName($row['share_with']); - } else { - $row['share_with_displayname'] = $row['share_with']; + } else if(isset($row['share_with']) && $row['share_with'] != '' && + $row['share_type'] === self::SHARE_TYPE_REMOTE) { + $addressBookEntries = \OC::$server->getContactsManager()->search($row['share_with'], ['CLOUD']); + foreach ($addressBookEntries as $entry) { + foreach ($entry['CLOUD'] as $cloudID) { + if ($cloudID === $row['share_with']) { + $row['share_with_displayname'] = $entry['FN']; + } + } + } } if ( isset($row['uid_owner']) && $row['uid_owner'] != '') { $row['displayname_owner'] = \OCP\User::getDisplayName($row['uid_owner']); |