Skip to content

Commit 1d26f2a

Browse files
committed
Use display name cache on getStorageInfo
Signed-off-by: Julius Härtl <jus@bitgrid.net>
1 parent b1421f6 commit 1d26f2a

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

apps/dav/tests/unit/Connector/Sabre/DirectoryTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,10 @@ public function testGetQuotaInfoUnlimited() {
288288
'\OC\Files\Storage\Wrapper\Quota' => false,
289289
]);
290290

291+
$storage->expects($this->once())
292+
->method('getOwner')
293+
->willReturn('user');
294+
291295
$storage->expects($this->never())
292296
->method('getQuota');
293297

@@ -325,6 +329,10 @@ public function testGetQuotaInfoSpecific() {
325329
['\OC\Files\Storage\Wrapper\Quota', true],
326330
]);
327331

332+
$storage->expects($this->once())
333+
->method('getOwner')
334+
->willReturn('user');
335+
328336
$storage->expects($this->once())
329337
->method('getQuota')
330338
->willReturn(1000);

lib/private/legacy/OC_Helper.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -542,11 +542,7 @@ public static function getStorageInfo($path, $rootInfo = null, $includeMountPoin
542542
}
543543

544544
$ownerId = $storage->getOwner($path);
545-
$ownerDisplayName = '';
546-
$owner = \OC::$server->getUserManager()->get($ownerId);
547-
if ($owner) {
548-
$ownerDisplayName = $owner->getDisplayName();
549-
}
545+
$ownerDisplayName = \OC::$server->getUserManager()->getDisplayName($ownerId) ?? '';
550546
if (substr_count($mount->getMountPoint(), '/') < 3) {
551547
$mountPoint = '';
552548
} else {

0 commit comments

Comments
 (0)