Skip to content
Merged
Changes from 1 commit
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
Next Next commit
use LazyUser in DefaultShareProvider
Signed-off-by: Robin Appelman <[email protected]>
  • Loading branch information
icewind1991 authored and come-nc committed Jun 17, 2024
commit 7f6a891110e7107c9056d8f5444bae62c57d89b7
11 changes: 6 additions & 5 deletions lib/private/Share20/DefaultShareProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
use OC\Share20\Exception\BackendError;
use OC\Share20\Exception\InvalidShare;
use OC\Share20\Exception\ProviderException;
use OC\User\LazyUser;
use OCP\AppFramework\Utility\ITimeFactory;
use OCP\DB\QueryBuilder\IQueryBuilder;
use OCP\Defaults;
Expand Down Expand Up @@ -909,8 +910,8 @@ public function getSharedWith($userId, $shareType, $node, $limit, $offset) {
}
$cursor->closeCursor();
} elseif ($shareType === IShare::TYPE_GROUP) {
$user = $this->userManager->get($userId);
$allGroups = ($user instanceof IUser) ? $this->groupManager->getUserGroupIds($user) : [];
$user = new LazyUser($userId, $this->userManager);
$allGroups = $this->groupManager->getUserGroupIds($user);

/** @var Share[] $shares2 */
$shares2 = [];
Expand Down Expand Up @@ -1045,9 +1046,9 @@ private function createShare($data) {

if ($share->getShareType() === IShare::TYPE_USER) {
$share->setSharedWith($data['share_with']);
$user = $this->userManager->get($data['share_with']);
if ($user !== null) {
$share->setSharedWithDisplayName($user->getDisplayName());
$displayName = $this->userManager->getDisplayName($data['share_with']);
if ($displayName !== null) {
$share->setSharedWithDisplayName($displayName);
}
} elseif ($share->getShareType() === IShare::TYPE_GROUP) {
$share->setSharedWith($data['share_with']);
Expand Down