Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2020-11-24 01:51:19 +0300
committerMorris Jobke <hey@morrisjobke.de>2021-06-17 11:19:07 +0300
commit095418493ef909d25808d278ee099fb34070c7fb (patch)
treebf5b5769659b6a4bf434762d8a79c6cf1a54f840 /apps/files_sharing/lib
parent330b8802f9b4537247e4341e05461e8cf54c405b (diff)
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.php9
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;
}