-
Notifications
You must be signed in to change notification settings - Fork 649
Use minijinja
templates for emails
#11420
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
9ec4a0d
to
0f87495
Compare
rebased to include the new email type from #11419 |
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.
A quick glance, and overall LGTM, thanks! I've also left a few nitpicks more related to unified coding style.
…age::from_template()`
…e::from_template()`
…essage::from_template()`
Thanks for the review! All of the feedback should be addressed now :) |
I defer to @eth3lbert's excellent review on the details. I definitely think that moving to a templating engine is the right call, but I'm not so sure I like the loss of the explicit input fields for each template, both from the perspective of type safety and for knowing what might be interpolated into the e-mails. That said, I don't know that I have a great alternative: the thought of having a proc macro or something to ensure that templates and contexts are in sync feels... terrifying, and well beyond the scope of what we should do here, So, 👍, but I also think we should remain open to continuing to iterate on the details over time. |
@LawnGnome yeah, I understand the concern. technically I guess we can try it out like this and see whether it is sufficient or not. If we see any issues with this approach we can always go back to explicit structs as the template inputs and/or improve our test suite for the templates. |
This PR refactors our email sending code to use
minijinja
templates instead offormat!()
and string concatenation. In the long term this even enables us to add dedicated templates for HTML emails too, or use template inheritance to use consistent email footers, etc.Before:
After (with templates):