diff options
author | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-25 20:42:03 +0200 |
---|---|---|
committer | Roeland Jago Douma <roeland@famdouma.nl> | 2018-03-25 20:42:03 +0200 |
commit | 7ebd96416ca9150a4d524547a18b5fce269016ca (patch) | |
tree | e83a6c34e9955c9b1a2894e9dac40417245db28c /apps | |
parent | 6c8caa1641732c57fe59483fc2cdd5bcd7bd0163 (diff) | |
download | nextcloud-server-7ebd96416ca9150a4d524547a18b5fce269016ca.tar.gz nextcloud-server-7ebd96416ca9150a4d524547a18b5fce269016ca.zip |
Remove deprecated OCP\User::getDisplayname
Signed-off-by: Roeland Jago Douma <roeland@famdouma.nl>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files_sharing/lib/ShareBackend/Folder.php | 10 | ||||
-rw-r--r-- | apps/user_ldap/tests/User_LDAPTest.php | 4 |
2 files changed, 10 insertions, 4 deletions
diff --git a/apps/files_sharing/lib/ShareBackend/Folder.php b/apps/files_sharing/lib/ShareBackend/Folder.php index c48a26300a2..0930f30eea7 100644 --- a/apps/files_sharing/lib/ShareBackend/Folder.php +++ b/apps/files_sharing/lib/ShareBackend/Folder.php @@ -41,6 +41,9 @@ class Folder extends File implements \OCP\Share_Backend_Collection { public function getParents($itemSource, $shareWith = null, $owner = null) { $result = array(); $parent = $this->getParentId($itemSource); + + $userManager = \OC::$server->getUserManager(); + while ($parent) { $shares = \OCP\Share::getItemSharedWithUser('folder', $parent, $shareWith, $owner); if ($shares) { @@ -49,8 +52,11 @@ class Folder extends File implements \OCP\Share_Backend_Collection { $share['collection']['path'] = $name; $share['collection']['item_type'] = 'folder'; $share['file_path'] = $name; - $displayNameOwner = \OCP\User::getDisplayName($share['uid_owner']); - $displayNameShareWith = \OCP\User::getDisplayName($share['share_with']); + + $ownerUser = $userManager->get($share['uid_owner']); + $displayNameOwner = $ownerUser === null ? $share['uid_owner'] : $ownerUser->getDisplayName(); + $shareWithUser = $userManager->get($share['share_with']); + $displayNameShareWith = $shareWithUser === null ? $share['share_with'] : $shareWithUser->getDisplayName(); $share['displayname_owner'] = $displayNameOwner ? $displayNameOwner : $share['uid_owner']; $share['share_with_displayname'] = $displayNameShareWith ? $displayNameShareWith : $share['uid_owner']; diff --git a/apps/user_ldap/tests/User_LDAPTest.php b/apps/user_ldap/tests/User_LDAPTest.php index 270e3eedbfd..2b5952c9742 100644 --- a/apps/user_ldap/tests/User_LDAPTest.php +++ b/apps/user_ldap/tests/User_LDAPTest.php @@ -1094,11 +1094,11 @@ class User_LDAPTest extends TestCase { ->willReturnCallback(function($uuid) { return $uuid . '1'; }); //with displayName - $result = \OCP\User::getDisplayName('gunslinger'); + $result = \OC::$server->getUserManager()->get('gunslinger')->getDisplayName(); $this->assertEquals('Roland Deschain', $result); //empty displayname retrieved - $result = \OCP\User::getDisplayName('newyorker'); + $result = \OC::$server->getUserManager()->get('newyorker')->getDisplayName(); $this->assertEquals('newyorker', $result); } |