forked from CGM_Public/pretix_original
Fix incorrect preview/history of subject rendering
This commit is contained in:
@@ -795,7 +795,7 @@ class Order(LockModel, LoggedModel):
|
|||||||
only be attached for this position and child positions, the link will only point to the
|
only be attached for this position and child positions, the link will only point to the
|
||||||
position and the attendee email will be used if available.
|
position and the attendee email will be used if available.
|
||||||
"""
|
"""
|
||||||
from pretix.base.services.mail import SendMailException, mail, render_mail
|
from pretix.base.services.mail import SendMailException, mail, render_mail, TolerantDict
|
||||||
|
|
||||||
if not self.email:
|
if not self.email:
|
||||||
return
|
return
|
||||||
@@ -810,6 +810,7 @@ class Order(LockModel, LoggedModel):
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
email_content = render_mail(template, context)
|
email_content = render_mail(template, context)
|
||||||
|
subject = subject.format_map(TolerantDict(context))
|
||||||
mail(
|
mail(
|
||||||
recipient, subject, template, context,
|
recipient, subject, template, context,
|
||||||
self.event, self.locale, self, headers=headers, sender=sender,
|
self.event, self.locale, self, headers=headers, sender=sender,
|
||||||
|
|||||||
@@ -55,7 +55,9 @@ from pretix.base.services.invoices import (
|
|||||||
invoice_qualified, regenerate_invoice,
|
invoice_qualified, regenerate_invoice,
|
||||||
)
|
)
|
||||||
from pretix.base.services.locking import LockTimeoutException
|
from pretix.base.services.locking import LockTimeoutException
|
||||||
from pretix.base.services.mail import SendMailException, render_mail
|
from pretix.base.services.mail import (
|
||||||
|
SendMailException, TolerantDict, render_mail,
|
||||||
|
)
|
||||||
from pretix.base.services.orders import (
|
from pretix.base.services.orders import (
|
||||||
OrderChangeManager, OrderError, approve_order, cancel_order, deny_order,
|
OrderChangeManager, OrderError, approve_order, cancel_order, deny_order,
|
||||||
extend_order, mark_order_expired, mark_order_refunded,
|
extend_order, mark_order_expired, mark_order_refunded,
|
||||||
@@ -1742,10 +1744,11 @@ class OrderSendMail(EventPermissionRequiredMixin, OrderViewMixin, FormView):
|
|||||||
with language(order.locale):
|
with language(order.locale):
|
||||||
email_context = get_email_context(event=order.event, order=order)
|
email_context = get_email_context(event=order.event, order=order)
|
||||||
email_template = LazyI18nString(form.cleaned_data['message'])
|
email_template = LazyI18nString(form.cleaned_data['message'])
|
||||||
|
email_subject = str(form.cleaned_data['subject']).format_map(TolerantDict(email_context))
|
||||||
email_content = render_mail(email_template, email_context)
|
email_content = render_mail(email_template, email_context)
|
||||||
if self.request.POST.get('action') == 'preview':
|
if self.request.POST.get('action') == 'preview':
|
||||||
self.preview_output = {
|
self.preview_output = {
|
||||||
'subject': _('Subject: {subject}').format(subject=form.cleaned_data['subject']),
|
'subject': _('Subject: {subject}').format(subject=email_subject),
|
||||||
'html': markdown_compile_email(email_content)
|
'html': markdown_compile_email(email_content)
|
||||||
}
|
}
|
||||||
return self.get(self.request, *self.args, **self.kwargs)
|
return self.get(self.request, *self.args, **self.kwargs)
|
||||||
|
|||||||
Reference in New Issue
Block a user