Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use LazyUser when creating the user folder #33578

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/private/Files/Node/Root.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

namespace OC\Files\Node;

use OC\User\LazyUser;
use OCP\Cache\CappedMemoryCache;
use OC\Files\FileInfo;
use OC\Files\Mount\Manager;
Expand Down Expand Up @@ -362,7 +363,7 @@ public function getName() {
* @throws NotPermittedException
*/
public function getUserFolder($userId) {
$userObject = $this->userManager->get($userId);
$userObject = new LazyUser($userId, $this->userManager);

if (is_null($userObject)) {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can someone confirm it's save to remove this full block?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (is_null($userObject)) {
if (is_null($userObject->getDisplayName())) {

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh wait that won't work 😩

$e = new NoUserException('Backends provided no user object');
Expand Down Expand Up @@ -477,7 +478,7 @@ public function getByIdInPath(int $id, string $path): array {
$absolutePath = rtrim($mount->getMountPoint() . $pathRelativeToMount, '/');
return $this->createNode($absolutePath, new FileInfo(
$absolutePath, $mount->getStorage(), $cacheEntry->getPath(), $cacheEntry, $mount,
\OC::$server->getUserManager()->get($mount->getStorage()->getOwner($pathRelativeToMount))
new LazyUser($mount->getStorage()->getOwner($pathRelativeToMount), $this->userManager)
));
}, $mountsContainingFile);

Expand Down