From 506c7731a6168e35bff28c32d9bea933aee907d4 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 12 Apr 2017 11:52:33 +0200 Subject: [PATCH] Don't duplicate the sentence with the header Signed-off-by: Joas Schilling --- apps/sharebymail/lib/ShareByMailProvider.php | 2 +- lib/private/Mail/EMailTemplate.php | 7 +++++-- lib/public/Mail/IEMailTemplate.php | 3 ++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/sharebymail/lib/ShareByMailProvider.php b/apps/sharebymail/lib/ShareByMailProvider.php index 8f63ef028d9..f2c68f9376d 100644 --- a/apps/sharebymail/lib/ShareByMailProvider.php +++ b/apps/sharebymail/lib/ShareByMailProvider.php @@ -264,7 +264,7 @@ class ShareByMailProvider implements IShareProvider { $emailTemplate = $this->mailer->createEMailTemplate(); $emailTemplate->addHeader(); - $emailTemplate->addHeading($this->l->t('%s shared »%s« with you', [$ownerDisplayName, $filename])); + $emailTemplate->addHeading($this->l->t('%s shared »%s« with you', [$ownerDisplayName, $filename]), false); if ($owner === $initiator) { $text = $this->l->t('%s shared »%s« with you.', [$ownerDisplayName, $filename]); diff --git a/lib/private/Mail/EMailTemplate.php b/lib/private/Mail/EMailTemplate.php index bfaee72bedd..f82ddc689eb 100644 --- a/lib/private/Mail/EMailTemplate.php +++ b/lib/private/Mail/EMailTemplate.php @@ -353,7 +353,8 @@ EOF; * Adds a paragraph to the body of the email * * @param string $text - * @param string $plainText Text that is used in the plain text email - if empty the $text is used + * @param string|bool $plainText Text that is used in the plain text email + * if empty the $text is used, if false none will be used */ public function addBodyText($text, $plainText = '') { if ($this->footerAdded) { @@ -369,7 +370,9 @@ EOF; } $this->htmlBody .= vsprintf($this->bodyText, [htmlspecialchars($text)]); - $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; + if ($plainText !== false) { + $this->plainBody .= $plainText . PHP_EOL . PHP_EOL; + } } /** diff --git a/lib/public/Mail/IEMailTemplate.php b/lib/public/Mail/IEMailTemplate.php index d0123f22739..8e3233ee426 100644 --- a/lib/public/Mail/IEMailTemplate.php +++ b/lib/public/Mail/IEMailTemplate.php @@ -72,7 +72,8 @@ interface IEMailTemplate { * Adds a paragraph to the body of the email * * @param string $text - * @param string $plainText Text that is used in the plain text email - if empty the $text is used + * @param string|bool $plainText Text that is used in the plain text email + * if empty the $text is used, if false none will be used * * @since 12.0.0 */