FIX email rendering should not include requirements

If no body is defined, the email is rendered according to a template. Clearing requirements prevent unnecessary styles/scripts to be included in the html (and that needs to be processed/stripped down the line).
This commit is contained in:
Thomas Portelange 2018-08-14 17:26:31 +02:00 committed by Robbie Averill
parent 1ad2d6535e
commit 27ac001d5b
1 changed files with 6 additions and 0 deletions

View File

@ -790,6 +790,9 @@ class Email extends ViewableData
return $this;
}
// Do not interfere with emails styles
Requirements::clear();
// Render plain part
if ($plainTemplate && !$plainPart) {
$plainPart = $this->renderWith($plainTemplate, $this->getData());
@ -806,6 +809,9 @@ class Email extends ViewableData
$htmlPartObject = DBField::create_field('HTMLFragment', $htmlPart);
$plainPart = $htmlPartObject->Plain();
}
// Rendering is finished
Requirements::restore();
// Fail if no email to send
if (!$plainPart && !$htmlPart) {