From b99264647d5ad7e27440a108fadf9bc509ca5873 Mon Sep 17 00:00:00 2001 From: Luca Date: Tue, 13 Feb 2024 15:32:23 +0100 Subject: [PATCH] feat: add {assignee} placeholder --- pretalx_musicrate/signals.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/pretalx_musicrate/signals.py b/pretalx_musicrate/signals.py index 3c7c5fb..e1c2d4d 100644 --- a/pretalx_musicrate/signals.py +++ b/pretalx_musicrate/signals.py @@ -1,9 +1,26 @@ from django.dispatch import receiver from django.urls import reverse from django.utils.translation import gettext_lazy as _ +from pretalx.mail.placeholders import SimpleFunctionalMailTextPlaceholder +from pretalx.mail.signals import register_mail_placeholders from pretalx.orga.signals import nav_event, nav_event_settings +@receiver(register_mail_placeholders) +def pretalx_musicrate_placeholders(sender, **kwargs): + return [ + SimpleFunctionalMailTextPlaceholder( + "assignee", + ["submission"], + lambda submission: assignee.user.name + if (assignee := submission.assignee) is not None + else "Günther", + "Günther", + _("The name of the submission's assignee"), + ) + ] + + @receiver(nav_event) def pretalx_musicrate_qrcode(sender, request, **kwargs): if not request.user.has_perm("orga.view_submissions", request.event):