Skip to content
Merged
Show file tree
Hide file tree
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: 5 additions & 0 deletions lib/public/Sharing/Recipient/ShareRecipient.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,11 @@ public function format(ISharingRegistry $registry, IFactory $l10nFactory, IURLGe
throw new RuntimeException('The recipient type is not registered: ' . $this->class);
}

if ($this->instance !== null) {
// TODO: Support federation
throw new RuntimeException('Currently only local recipients are supported.');
}

$displayName = $recipientType->getRecipientDisplayName($this->value) ?? $this->value;
if (!$isUnique) {
$displayName .= ' (' . $recipientType->getDisplayName($l10nFactory) . ': ' . $this->value . ')';
Expand Down
13 changes: 9 additions & 4 deletions lib/public/Sharing/ShareUser.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,20 @@ public function isCurrentUser(ShareAccessContext $accessContext): bool {
* @since 35.0.0
*/
public function format(IUserManager $userManager): array {
$ownerUser = $userManager->get($this->userId);
if ($ownerUser === null) {
throw new RuntimeException('The userId does not exist: ' . $this->userId);
if ($this->instance !== null) {
// TODO: Support federation
throw new RuntimeException('Currently only local users are supported.');
}

$displayName = $userManager->getDisplayName($this->userId);
if ($displayName === null) {
throw new RuntimeException('No display name for user ' . $this->userId);
}

return [
'user_id' => $this->userId,
'instance' => $this->instance,
'display_name' => $ownerUser->getDisplayName(),
'display_name' => $displayName,
'icon' => (new ShareIconURL(
$userManager->getAvatarUrlLight($this->userId, 64),
$userManager->getAvatarUrlDark($this->userId, 64),
Expand Down
Loading