aboutsummaryrefslogtreecommitdiffstats
path: root/lib/private/User/DisplayNameCache.php
diff options
context:
space:
mode:
authorCarl Schwan <carl@carlschwan.eu>2022-08-16 14:10:05 +0200
committerCarl Schwan <carl@carlschwan.eu>2022-08-16 14:10:05 +0200
commit8004aa77212eed6dd1142c713275a4e0c5d0c40e (patch)
treef9d0b1589dd354ddbe55f7738f6df95c75fae29f /lib/private/User/DisplayNameCache.php
parent604c1752845df068a7dd5d168abfbfc04065ac3f (diff)
downloadnextcloud-server-8004aa77212eed6dd1142c713275a4e0c5d0c40e.tar.gz
nextcloud-server-8004aa77212eed6dd1142c713275a4e0c5d0c40e.zip
Make DisplayNameCache return null if user doesn't exists
Signed-off-by: Carl Schwan <carl@carlschwan.eu>
Diffstat (limited to 'lib/private/User/DisplayNameCache.php')
-rw-r--r--lib/private/User/DisplayNameCache.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/private/User/DisplayNameCache.php b/lib/private/User/DisplayNameCache.php
index 22a79863e49..5d1cc8940d7 100644
--- a/lib/private/User/DisplayNameCache.php
+++ b/lib/private/User/DisplayNameCache.php
@@ -47,7 +47,7 @@ class DisplayNameCache implements IEventListener {
$this->userManager = $userManager;
}
- public function getDisplayName(string $userId) {
+ public function getDisplayName(string $userId): ?string {
if (isset($this->cache[$userId])) {
return $this->cache[$userId];
}
@@ -61,7 +61,7 @@ class DisplayNameCache implements IEventListener {
if ($user) {
$displayName = $user->getDisplayName();
} else {
- $displayName = $userId;
+ $displayName = null;
}
$this->cache[$userId] = $displayName;
$this->memCache->set($userId, $displayName, 60 * 10); // 10 minutes