Prefix notification emails with the event slug

This commit is contained in:
Raphael Michel
2019-05-16 11:09:20 +02:00
parent 5f82db3949
commit 6c582b8f8c
3 changed files with 7 additions and 2 deletions

View File

@@ -104,7 +104,11 @@ def send_notification_mail(notification: Notification, user: User):
mail_send_task.apply_async(kwargs={
'to': [user.email],
'subject': '[{}] {}'.format(settings.PRETIX_INSTANCE_NAME, notification.title),
'subject': '[{}] {}: {}'.format(
settings.PRETIX_INSTANCE_NAME,
notification.event.settings.mail_prefix or notification.event.slug.upper(),
notification.title
),
'body': body_plain,
'html': body_html,
'sender': settings.MAIL_FROM,

View File

@@ -145,7 +145,7 @@ def get_tickets_for_order(order):
retval = generate_orderposition(pos.pk, p.identifier)
if not retval:
continue
ct = CachedCombinedTicket.objects.get(pk=retval)
ct = CachedTicket.objects.get(pk=retval)
tickets.append((
"{}-{}-{}-{}{}".format(
order.event.slug.upper(), order.code, pos.positionid, ct.provider, ct.extension,

View File

@@ -65,6 +65,7 @@ def test_notification_trigger_event_specific(event, order, user, monkeypatch_on_
with transaction.atomic():
order.log_action('pretix.event.order.paid', {})
assert len(djmail.outbox) == 1
assert djmail.outbox[0].subject.endswith("DUMMY: Order FOO has been marked as paid.")
@pytest.mark.django_db