Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork9.7k
[Mailer] require a body renderer only if message has not been rendered yet#48481
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
xabbuh commentedDec 5, 2022
| Q | A |
|---|---|
| Branch? | 6.2 |
| Bug fix? | yes |
| New feature? | no |
| Deprecations? | no |
| Tickets | Fix#48472 |
| License | MIT |
| Doc PR |
| $message =$event->getMessage(); | ||
| if ($messageinstanceof TemplatedEmail && ($message->getTextTemplate() ||$message->getHtmlTemplate())) { | ||
| if ($messageinstanceof TemplatedEmail && (!$message->getTextBody() &&$message->getTextTemplate() || !$message->getHtmlBody() &&$message->getHtmlTemplate())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Would this be enough?
| if ($messageinstanceof TemplatedEmail && (!$message->getTextBody() &&$message->getTextTemplate() ||!$message->getHtmlBody() &&$message->getHtmlTemplate())) { | |
| if ($messageinstanceof TemplatedEmail && (null !==$message->getTextTemplate() ||null !==$message->getHtmlTemplate())) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I don't think so. Both methods are overwritten in theNotificationEmail class:https://github.com/symfony/symfony/blob/6.2/src/Symfony/Bridge/Twig/Mime/NotificationEmail.php#L158-L174
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
for me
(null !== $message->getTextTemplate() || null !== $message->getHtmlTemplate())istrue,$message->getTextTemplate() is@email/default/notification/body.txt.twig and$message->getHtmlTemplate() is@email/default/notification/body.html.twig
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Let me have a look.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
For my issue#48472 this fixes it:
if ($message instanceof TemplatedEmail && (!$message->getTextBody() && $message->getTextTemplate() || !$message->getHtmlBody() && $message->getHtmlTemplate())) {
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
See#48505 for an alternative fix.
fabpot commentedDec 6, 2022
See#48505 for an alternative fix. |
xabbuh commentedDec 6, 2022
closing in favor of#48505 |
This PR was merged into the 6.2 branch.Discussion----------[Mailer] Fix rendered templates for notifications| Q | A| ------------- | ---| Branch? | 6.2| Bug fix? | yes| New feature? | no <!-- please update src/**/CHANGELOG.md files -->| Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files -->| Tickets |Fix#48472| License | MIT| Doc PR | n/aAlternative to#48481Commits-------085185d [Mailer] Fix rendered templates for notifications