diff options
author | Morris Jobke <hey@morrisjobke.de> | 2020-11-23 23:51:19 +0100 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2021-06-17 10:19:07 +0200 |
commit | 095418493ef909d25808d278ee099fb34070c7fb (patch) | |
tree | bf5b5769659b6a4bf434762d8a79c6cf1a54f840 /apps/files_sharing/lib | |
parent | 330b8802f9b4537247e4341e05461e8cf54c405b (diff) | |
download | nextcloud-server-095418493ef909d25808d278ee099fb34070c7fb.tar.gz nextcloud-server-095418493ef909d25808d278ee099fb34070c7fb.zip |
Use proper methods for display name retrieval
Signed-off-by: Morris Jobke <hey@morrisjobke.de>
Diffstat (limited to 'apps/files_sharing/lib')
-rw-r--r-- | apps/files_sharing/lib/Cache.php | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/apps/files_sharing/lib/Cache.php b/apps/files_sharing/lib/Cache.php index 25e92d23962..ab8adda725e 100644 --- a/apps/files_sharing/lib/Cache.php +++ b/apps/files_sharing/lib/Cache.php @@ -38,6 +38,7 @@ use OCP\Files\Search\ISearchBinaryOperator; use OCP\Files\Search\ISearchComparison; use OCP\Files\Search\ISearchOperator; use OCP\Files\StorageNotAvailableException; +use OCP\IUserManager; /** * Metadata cache for shared files @@ -174,7 +175,13 @@ class Cache extends CacheJail { private function getOwnerDisplayName() { if (!$this->ownerDisplayName) { - $this->ownerDisplayName = \OC_User::getDisplayName($this->storage->getOwner('')); + $uid = $this->storage->getOwner(''); + $user = \OC::$server->get(IUserManager::class)->get($uid); + if ($user) { + $this->ownerDisplayName = $user->getDisplayName(); + } else { + $this->ownerDisplayName = $uid; + } } return $this->ownerDisplayName; } |