aboutsummaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2019-09-09 14:40:14 +0200
committerJoas Schilling <coding@schilljs.com>2019-11-12 17:37:47 +0100
commit0fe4b717dcc5ad50853e0a887bfa60416657988d (patch)
treef5cbcf684c39699df55963ca7b6a8bce2bcab538 /apps
parente79ab7d0c565425c9d103930787f37c1ed3a9ed6 (diff)
downloadnextcloud-server-0fe4b717dcc5ad50853e0a887bfa60416657988d.tar.gz
nextcloud-server-0fe4b717dcc5ad50853e0a887bfa60416657988d.zip
Correctly use the displayname of the sharer in the notification
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/lib/Notification/Notifier.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/apps/files_sharing/lib/Notification/Notifier.php b/apps/files_sharing/lib/Notification/Notifier.php
index 57b96be57b2..52bb0eb8236 100644
--- a/apps/files_sharing/lib/Notification/Notifier.php
+++ b/apps/files_sharing/lib/Notification/Notifier.php
@@ -165,7 +165,12 @@ class Notifier implements INotifier {
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',
@@ -174,8 +179,8 @@ class Notifier implements INotifier {
],
'user' => [
'type' => 'user',
- 'id' => $share->getShareOwner(),
- 'name' => $share->getShareOwner(),
+ 'id' => $sharer->getUID(),
+ 'name' => $sharer->getDisplayName(),
],
];
break;
@@ -196,7 +201,12 @@ class Notifier implements INotifier {
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',
@@ -210,8 +220,8 @@ class Notifier implements INotifier {
],
'user' => [
'type' => 'user',
- 'id' => $share->getShareOwner(),
- 'name' => $share->getShareOwner(),
+ 'id' => $sharer->getUID(),
+ 'name' => $sharer->getDisplayName(),
],
];
break;