Remove redundant body creation in case of only a preamble is set
This commit is contained in:
parent
44eebde9cb
commit
6730ddfd99
1 changed files with 5 additions and 9 deletions
|
@ -36,11 +36,11 @@ use Psr\Log\LoggerInterface;
|
||||||
class SystemMailBuilder extends MailBuilder
|
class SystemMailBuilder extends MailBuilder
|
||||||
{
|
{
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $subject;
|
protected $subject = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $preamble;
|
protected $preamble = '';
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $body;
|
protected $body = null;
|
||||||
|
|
||||||
/** @var string */
|
/** @var string */
|
||||||
protected $siteAdmin;
|
protected $siteAdmin;
|
||||||
|
@ -71,10 +71,6 @@ class SystemMailBuilder extends MailBuilder
|
||||||
*/
|
*/
|
||||||
public function withMessage(string $subject, string $preamble, string $body = null)
|
public function withMessage(string $subject, string $preamble, string $body = null)
|
||||||
{
|
{
|
||||||
if (!isset($body)) {
|
|
||||||
$body = $preamble;
|
|
||||||
}
|
|
||||||
|
|
||||||
$this->subject = $subject;
|
$this->subject = $subject;
|
||||||
$this->preamble = $preamble;
|
$this->preamble = $preamble;
|
||||||
$this->body = $body;
|
$this->body = $body;
|
||||||
|
@ -98,7 +94,7 @@ class SystemMailBuilder extends MailBuilder
|
||||||
*/
|
*/
|
||||||
protected function getHtmlMessage()
|
protected function getHtmlMessage()
|
||||||
{
|
{
|
||||||
$htmlVersion = BBCode::convert($this->body);
|
$htmlVersion = !empty($this->body) ? BBCode::convert($this->body) : '';
|
||||||
|
|
||||||
// load the template for private message notifications
|
// load the template for private message notifications
|
||||||
$tpl = Renderer::getMarkupTemplate('email/system/html.tpl');
|
$tpl = Renderer::getMarkupTemplate('email/system/html.tpl');
|
||||||
|
@ -117,7 +113,7 @@ class SystemMailBuilder extends MailBuilder
|
||||||
*/
|
*/
|
||||||
protected function getPlaintextMessage()
|
protected function getPlaintextMessage()
|
||||||
{
|
{
|
||||||
$textVersion = BBCode::toPlaintext($this->body);
|
$textVersion = !empty($this->body) ? BBCode::toPlaintext($this->body) : '';
|
||||||
|
|
||||||
// load the template for private message notifications
|
// load the template for private message notifications
|
||||||
$tpl = Renderer::getMarkupTemplate('email/system/text.tpl');
|
$tpl = Renderer::getMarkupTemplate('email/system/text.tpl');
|
||||||
|
|
Loading…
Reference in a new issue