This commit is contained in:
j3d1 2024-05-04 00:59:11 +02:00
parent 5f5a2f008d
commit bc0d06e00d

View file

@ -1,4 +1,5 @@
import jinja2 import jinja2
from channels.db import database_sync_to_async
from core.settings import PRIMARY_HOST from core.settings import PRIMARY_HOST
from notifications.models import MessageTemplate from notifications.models import MessageTemplate
@ -36,18 +37,21 @@ def render_template(template, **kwargs):
return None return None
@database_sync_to_async
def render_auto_reply(ticket): def render_auto_reply(ticket):
eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded
return render_template('auto_reply', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(), return render_template('auto_reply', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(),
ticket_id=ticket.id, event_slug=eventslug, ticket_url=ticket_url(ticket)) ticket_id=ticket.id, event_slug=eventslug, ticket_url=ticket_url(ticket))
@database_sync_to_async
def render_notification_new_ticket(ticket): def render_notification_new_ticket(ticket):
eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded
return render_template('new_issue_notification', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(), return render_template('new_issue_notification', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(),
ticket_id=ticket.id, event_slug=eventslug, ticket_url=ticket_url(ticket)) ticket_id=ticket.id, event_slug=eventslug, ticket_url=ticket_url(ticket))
@database_sync_to_async
def render_notification_reply_ticket(ticket): def render_notification_reply_ticket(ticket):
eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded eventslug = ticket.event.slug if ticket.event else "37C3" # TODO 37C3 should not be hardcoded
return render_template('reply_issue_notification', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(), return render_template('reply_issue_notification', ticket_name=ticket.name, ticket_uuid=ticket.short_uuid(),