mirror of
https://github.com/pretix/pretix.git
synced 2025-12-05 21:32:28 +00:00
Compare commits
1 Commits
v2025.10.0
...
fix-order-
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7648cb2e35 |
@@ -405,8 +405,12 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
attach_cid_images(html_message, cid_images, verify_ssl=True)
|
||||
email.attach_alternative(html_message, "multipart/related")
|
||||
|
||||
log_target = None
|
||||
|
||||
if user:
|
||||
user = User.objects.get(pk=user)
|
||||
error_log_action_type = 'pretix.user.email.error'
|
||||
log_target = user
|
||||
|
||||
if event:
|
||||
with scopes_disabled():
|
||||
@@ -426,12 +430,15 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
with cm():
|
||||
if customer:
|
||||
customer = Customer.objects.get(pk=customer)
|
||||
log_target = user or customer
|
||||
if not user:
|
||||
error_log_action_type = 'pretix.customer.email.error'
|
||||
log_target = customer
|
||||
|
||||
if event:
|
||||
if order:
|
||||
try:
|
||||
order = event.orders.get(pk=order)
|
||||
error_log_action_type = 'pretix.event.order.email.error'
|
||||
log_target = order
|
||||
except Order.DoesNotExist:
|
||||
order = None
|
||||
@@ -574,7 +581,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
except MaxRetriesExceededError:
|
||||
if log_target:
|
||||
log_target.log_action(
|
||||
'pretix.email.error',
|
||||
error_log_action_type,
|
||||
data={
|
||||
'subject': 'SMTP code {}, max retries exceeded'.format(e.smtp_code),
|
||||
'message': e.smtp_error.decode() if isinstance(e.smtp_error, bytes) else str(e.smtp_error),
|
||||
@@ -587,7 +594,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
logger.exception('Error sending email')
|
||||
if log_target:
|
||||
log_target.log_action(
|
||||
'pretix.email.error',
|
||||
error_log_action_type,
|
||||
data={
|
||||
'subject': 'SMTP code {}'.format(e.smtp_code),
|
||||
'message': e.smtp_error.decode() if isinstance(e.smtp_error, bytes) else str(e.smtp_error),
|
||||
@@ -618,7 +625,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
message.append(f'{e}: {val[0]} {val[1].decode()}')
|
||||
|
||||
log_target.log_action(
|
||||
'pretix.email.error',
|
||||
error_log_action_type,
|
||||
data={
|
||||
'subject': 'SMTP error',
|
||||
'message': '\n'.join(message),
|
||||
@@ -635,7 +642,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
except MaxRetriesExceededError:
|
||||
if log_target:
|
||||
log_target.log_action(
|
||||
'pretix.email.error',
|
||||
error_log_action_type,
|
||||
data={
|
||||
'subject': 'Internal error',
|
||||
'message': f'Max retries exceeded after error "{str(e)}"',
|
||||
@@ -646,7 +653,7 @@ def mail_send_task(self, *args, to: List[str], subject: str, body: str, html: st
|
||||
raise e
|
||||
if log_target:
|
||||
log_target.log_action(
|
||||
'pretix.email.error',
|
||||
error_log_action_type,
|
||||
data={
|
||||
'subject': 'Internal error',
|
||||
'message': str(e),
|
||||
|
||||
@@ -719,6 +719,7 @@ class CoreUserImpersonatedLogEntryType(UserImpersonatedLogEntryType):
|
||||
'pretix.customer.anonymized': _('The account has been disabled and anonymized.'),
|
||||
'pretix.customer.password.resetrequested': _('A new password has been requested.'),
|
||||
'pretix.customer.password.set': _('A new password has been set.'),
|
||||
'pretix.customer.email.error': _('Sending of an email has failed.'),
|
||||
'pretix.reusable_medium.created': _('The reusable medium has been created.'),
|
||||
'pretix.reusable_medium.created.auto': _('The reusable medium has been created automatically.'),
|
||||
'pretix.reusable_medium.changed': _('The reusable medium has been changed.'),
|
||||
@@ -752,6 +753,7 @@ class CoreUserImpersonatedLogEntryType(UserImpersonatedLogEntryType):
|
||||
'pretix.user.anonymized': _('This user has been anonymized.'),
|
||||
'pretix.user.oauth.authorized': _('The application "{application_name}" has been authorized to access your '
|
||||
'account.'),
|
||||
'pretix.user.email.error': _('Sending of an email has failed.'),
|
||||
'pretix.control.auth.user.forgot_password.mail_sent': _('Password reset mail sent.'),
|
||||
'pretix.control.auth.user.forgot_password.recovered': _('The password has been reset.'),
|
||||
'pretix.control.auth.user.forgot_password.denied.repeated': _('A repeated password reset has been denied, as '
|
||||
|
||||
Reference in New Issue
Block a user