diff options
author | Joas Schilling <coding@schilljs.com> | 2017-09-15 11:01:21 +0200 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2017-10-18 15:12:03 +0200 |
commit | 3119fd41ceebbdab33c4dd86ce0b60b4dc9010e9 (patch) | |
tree | f79efab1f9506a452e54fd32e201234410969b1b /apps | |
parent | c9af36a9ab05e808df526a2054c30364ee02241c (diff) | |
download | nextcloud-server-3119fd41ceebbdab33c4dd86ce0b60b4dc9010e9.tar.gz nextcloud-server-3119fd41ceebbdab33c4dd86ce0b60b4dc9010e9.zip |
Set the data from the template
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/sharebymail/lib/ShareByMailProvider.php | 12 | ||||
-rw-r--r-- | apps/sharebymail/tests/ShareByMailProviderTest.php | 40 |
2 files changed, 11 insertions, 41 deletions
diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 6e0664a8147..f610a1a5fa9 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -427,9 +427,7 @@ class ShareByMailProvider implements IShareProvider { $emailTemplate->addFooter(); } - $message->setSubject($emailTemplate->renderSubject()); - $message->setPlainBody($emailTemplate->renderText()); - $message->setHtmlBody($emailTemplate->renderHtml()); + $message->useTemplate($emailTemplate); $this->mailer->send($message); } @@ -491,9 +489,7 @@ class ShareByMailProvider implements IShareProvider { } $message->setTo([$shareWith]); - $message->setSubject($emailTemplate->renderSubject()); - $message->setBody($emailTemplate->renderText(), 'text/plain'); - $message->setHtmlBody($emailTemplate->renderHtml()); + $message->useTemplate($emailTemplate); $this->mailer->send($message); $this->createPasswordSendActivity($share, $shareWith, false); @@ -547,9 +543,7 @@ class ShareByMailProvider implements IShareProvider { $message->setFrom([$initiatorEMailAddress => $initiatorDisplayName]); } $message->setTo([$initiatorEMailAddress => $initiatorDisplayName]); - $message->setSubject($emailTemplate->renderSubject()); - $message->setBody($emailTemplate->renderText(), 'text/plain'); - $message->setHtmlBody($emailTemplate->renderHtml()); + $message->useTemplate($emailTemplate); $this->mailer->send($message); $this->createPasswordSendActivity($share, $shareWith, true); diff --git a/apps/sharebymail/tests/ShareByMailProviderTest.php b/apps/sharebymail/tests/ShareByMailProviderTest.php index 23e61ee58f1..68a645ec0e6 100644 --- a/apps/sharebymail/tests/ShareByMailProviderTest.php +++ b/apps/sharebymail/tests/ShareByMailProviderTest.php @@ -835,26 +835,14 @@ class ShareByMailProviderTest extends TestCase { ->expects($this->once()) ->method('addFooter') ->with('UnitTestCloud - Testing like 1990'); - $message - ->expects($this->once()) - ->method('setSubject') - ->willReturn('Mrs. Owner User shared »file.txt« with you'); $template ->expects($this->once()) - ->method('renderText') - ->willReturn('Text Render'); - $message - ->expects($this->once()) - ->method('setPlainBody') - ->with('Text Render'); - $template - ->expects($this->once()) - ->method('renderHtml') - ->willReturn('HTML Render'); + ->method('setSubject') + ->with('Mrs. Owner User shared »file.txt« with you'); $message ->expects($this->once()) - ->method('setHtmlBody') - ->with('HTML Render'); + ->method('useTemplate') + ->with($template); $this->mailer ->expects($this->once()) ->method('send') @@ -936,26 +924,14 @@ class ShareByMailProviderTest extends TestCase { ->expects($this->once()) ->method('addFooter') ->with(''); - $message - ->expects($this->once()) - ->method('setSubject') - ->willReturn('Mr. Initiator User shared »file.txt« with you'); $template ->expects($this->once()) - ->method('renderText') - ->willReturn('Text Render'); - $message - ->expects($this->once()) - ->method('setPlainBody') - ->with('Text Render'); - $template - ->expects($this->once()) - ->method('renderHtml') - ->willReturn('HTML Render'); + ->method('setSubject') + ->with('Mr. Initiator User shared »file.txt« with you'); $message ->expects($this->once()) - ->method('setHtmlBody') - ->with('HTML Render'); + ->method('useTemplate') + ->with($template); $this->mailer ->expects($this->once()) ->method('send') |