@@ -292,11 +292,9 @@ function(SharesToken $shareToken) {
292
292
}
293
293
294
294
if ($ circle ->getViewer () === null ) {
295
- $ author = $ circle ->getOwner ()
296
- ->getUserId ();
295
+ $ author = $ circle ->getOwner ();
297
296
} else {
298
- $ author = $ circle ->getViewer ()
299
- ->getUserId ();
297
+ $ author = $ circle ->getViewer ();
300
298
}
301
299
302
300
$ recipient = $ member ->getUserId ();
@@ -314,9 +312,7 @@ function(SharesToken $shareToken) {
314
312
$ recipient = $ emails [0 ];
315
313
}
316
314
317
- $ this ->sendMailExitingShares (
318
- $ circle , $ unknownShares , MiscService::getDisplay ($ author , Member::TYPE_USER ), $ member , $ recipient
319
- );
315
+ $ this ->sendMailExitingShares ($ circle , $ unknownShares , $ author , $ member , $ recipient );
320
316
}
321
317
322
318
@@ -413,17 +409,13 @@ private function sharedByMail(
413
409
$ this ->l10n = OC ::$ server ->getL10N (Application::APP_NAME , $ lang );
414
410
}
415
411
412
+ $ displayName = $ this ->miscService ->getDisplayName ($ share ->getSharedBy ());
416
413
try {
417
414
$ this ->sendMail (
418
415
$ share ->getNode ()
419
- ->getName (), $ link ,
420
- MiscService::getDisplay ($ share ->getSharedBy (), Member::TYPE_USER ),
421
- $ circle ->getName (), $ email
422
- );
423
- $ this ->sendPasswordByMail (
424
- $ share , MiscService::getDisplay ($ share ->getSharedBy (), Member::TYPE_USER ),
425
- $ email , $ password
416
+ ->getName (), $ link , $ displayName , $ circle ->getName (), $ email
426
417
);
418
+ $ this ->sendPasswordByMail ($ share , $ displayName , $ email , $ password );
427
419
} catch (Exception $ e ) {
428
420
OC ::$ server ->getLogger ()
429
421
->log (1 , 'Circles::sharedByMail - mail were not sent: ' . $ e ->getMessage ());
@@ -589,12 +581,12 @@ private function generateEmailTemplate($subject, $text, $fileName, $link, $autho
589
581
/**
590
582
* @param Circle $circle
591
583
* @param array $unknownShares
592
- * @param string $author
584
+ * @param Member $author
593
585
* @param Member $member
594
586
* @param string $recipient
595
587
*/
596
588
public function sendMailExitingShares (
597
- Circle $ circle , array $ unknownShares , $ author , Member $ member , $ recipient
589
+ Circle $ circle , array $ unknownShares , Member $ author , Member $ member , string $ recipient
598
590
) {
599
591
$ data = [];
600
592
@@ -615,9 +607,9 @@ public function sendMailExitingShares(
615
607
}
616
608
617
609
try {
618
- $ template = $ this ->generateMailExitingShares ($ author , $ circle ->getName ());
610
+ $ template = $ this ->generateMailExitingShares ($ author-> getCachedName () , $ circle ->getName ());
619
611
$ this ->fillMailExistingShares ($ template , $ data );
620
- $ this ->sendMailExistingShares ($ template , $ author , $ recipient );
612
+ $ this ->sendMailExistingShares ($ template , $ author-> getCachedName () , $ recipient );
621
613
$ this ->sendPasswordExistingShares ($ author , $ recipient , $ password );
622
614
} catch (Exception $ e ) {
623
615
$ this ->logger ->log (2 , 'Failed to send mail about existing share ' . $ e ->getMessage ());
@@ -628,19 +620,18 @@ public function sendMailExitingShares(
628
620
/**
629
621
* @param $author
630
622
* @param string $email
631
- *
632
623
* @param $password
633
624
*
634
625
* @throws Exception
635
626
*/
636
- protected function sendPasswordExistingShares ($ author , $ email , $ password ) {
627
+ protected function sendPasswordExistingShares (Member $ author , string $ email , string $ password ) {
637
628
if (!$ this ->configService ->sendPasswordByMail () || $ password === '' ) {
638
629
return ;
639
630
}
640
631
641
632
$ message = $ this ->mailer ->createMessage ();
642
633
643
- $ authorUser = $ this ->userManager ->get ($ author );
634
+ $ authorUser = $ this ->userManager ->get ($ author-> getUserId () );
644
635
$ authorName = ($ authorUser instanceof IUser) ? $ authorUser ->getDisplayName () : $ author ;
645
636
$ authorEmail = ($ authorUser instanceof IUser) ? $ authorUser ->getEMailAddress () : null ;
646
637
0 commit comments