Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

[TwigBridge] Render email once#39733

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

Merged
derrabus merged 1 commit intosymfony:4.4fromjderusse:twig-render-email-once
Mar 5, 2021

Conversation

@jderusse
Copy link
Member

@jderussejderusse commentedJan 5, 2021
edited
Loading

QA
Branch?4.4
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#39718
LicenseMIT
Doc PR-

When\Symfony\Component\Mailer\Mailer send an email via the Bus (async) it dispatches anMessageEvent, then the consumer call the\Symfony\Component\Mailer\Transport\AbstractTransport::send method which also dispatches anMessageEvent.

This event is listened by\Symfony\Bridge\Twig\Mime\BodyRenderer::render which rendered twice an email.

I'm not sure why the event is send twice, and if we could safely remove one of them (or maybe deprecating theMessageEvent, in favor ofSendMessageEvent +AsyncMessageEvent)

This PR store a flag in the Message to avoid rendering it twice.

@Nyholm
Copy link
Member

@carsonbot do you know who could review this?

@Nyholm
Copy link
Member

@carsonbot please find me a reviewer

chalasr reacted with rocket emoji

@carsonbot
Copy link

@pupaxxo could maybe review this PR?

Copy link
Member

@NyholmNyholm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

Thank you

@nicolas-grekasnicolas-grekas added this to the5.x milestoneJan 7, 2021
@carsonbotcarsonbot changed the titleRender email once[TwigBridge] Render email onceJan 8, 2021
@ajgarlag
Copy link
Contributor

I think that this PR is not a feature, but a bug fix and that it should be merged into the 4.4 branch.

My problem is that when my app sends a templated email to the async transport, it is rerenderd in an HTTP context and stored with the URLs pointing to the correct hostname, but when the message is consumed from the consolemessage:consume command it is rendered again in a CLI context, and the URL finally points tolocalhost.

I know that it can be fixed by setting therouter.request_context.host parameter, but it is not so easy in a multitenant environment, and it's annoying to see that the email body in the profiler differs from the email body really sent to my address.

@jderusse
Copy link
MemberAuthor

I know that it can be fixed by setting therouter.request_context.host parameter, but it is not so easy in a multitenant environment, and it's annoying to see that the email body in the profiler differs from the email body really sent to my address.

This issue is addressed by another of my PR 😛#39688

@ajgarlag
Copy link
Contributor

This issue is addressed by another of my PR stuck_out_tongue#39688

That is a great new feature.

But IMO this PR is a bug fix and shoud be merged into v4.4 to fix#39718.

@jderussejderusse changed the base branch from5.x to4.4February 8, 2021 22:22
@jderussejderusse modified the milestones:5.x,4.4Feb 8, 2021
@jderusse
Copy link
MemberAuthor

rebased on 4.4

ajgarlag reacted with thumbs up emoji

@ajgarlag
Copy link
Contributor

I though this PR would be merged before releasing version4.4.20. Can I help to get it merged soon?

Thanks

derrabus and Nyholm reacted with thumbs up emoji

@derrabus
Copy link
Member

Thank you Jérémy.

@derrabusderrabus merged commit13055b6 intosymfony:4.4Mar 5, 2021
@fabpotfabpot mentioned this pull requestMar 10, 2021
@PhilETaylor
Copy link
Contributor

This has caused a b/c break :-( details incoming...

@PhilETaylor
Copy link
Contributor

Serialization of 'Closure' is not allowed#40445

@jderussejderusse deleted the twig-render-email-once branchMarch 11, 2021 13:38
@fabpotfabpot mentioned this pull requestMar 29, 2021
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@javiereguiluzjaviereguiluzjaviereguiluz approved these changes

@NyholmNyholmNyholm approved these changes

@derrabusderrabusderrabus approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

4.4

Development

Successfully merging this pull request may close these issues.

TemplatedEmail are rendered two times

8 participants

@jderusse@Nyholm@carsonbot@ajgarlag@derrabus@PhilETaylor@javiereguiluz@nicolas-grekas

[8]ページ先頭

©2009-2025 Movatter.jp