Skip to content

Commit

Permalink
Correctly use the displayname of the sharer in the notification
Browse files Browse the repository at this point in the history
Signed-off-by: Joas Schilling <[email protected]>
  • Loading branch information
nickvergessen committed Nov 12, 2019
1 parent e79ab7d commit 0fe4b71
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions apps/files_sharing/lib/Notification/Notifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,12 @@ protected function parseShareInvitation(IShare $share, INotification $notificati
throw new AlreadyProcessedException();
}

$subject = $l->t('You received {share} as a share from {user}');
$sharer = $this->userManager->get($share->getSharedBy());
if (!$sharer instanceof IUser) {
throw new \InvalidArgumentException('Temporary failure');
}

$subject = $l->t('You received {share} as a share by {user}');
$subjectParameters = [
'share' => [
'type' => 'highlight',
Expand All @@ -174,8 +179,8 @@ protected function parseShareInvitation(IShare $share, INotification $notificati
],
'user' => [
'type' => 'user',
'id' => $share->getShareOwner(),
'name' => $share->getShareOwner(),
'id' => $sharer->getUID(),
'name' => $sharer->getDisplayName(),
],
];
break;
Expand All @@ -196,7 +201,12 @@ protected function parseShareInvitation(IShare $share, INotification $notificati
throw new AlreadyProcessedException();
}

$subject = $l->t('You received {share} to group {group} as a share from {user}');
$sharer = $this->userManager->get($share->getSharedBy());
if (!$sharer instanceof IUser) {
throw new \InvalidArgumentException('Temporary failure');
}

$subject = $l->t('You received {share} to group {group} as a share by {user}');
$subjectParameters = [
'share' => [
'type' => 'highlight',
Expand All @@ -210,8 +220,8 @@ protected function parseShareInvitation(IShare $share, INotification $notificati
],
'user' => [
'type' => 'user',
'id' => $share->getShareOwner(),
'name' => $share->getShareOwner(),
'id' => $sharer->getUID(),
'name' => $sharer->getDisplayName(),
],
];
break;
Expand Down

0 comments on commit 0fe4b71

Please sign in to comment.