diff --git a/core/notifications/dispatch.py b/core/notifications/dispatch.py index 37494a0..389535e 100644 --- a/core/notifications/dispatch.py +++ b/core/notifications/dispatch.py @@ -27,7 +27,6 @@ async def email_notify(message, email): await send_smtp(mail) - class NotificationDispatcher: channel_layer = None room_group_name = "general" @@ -65,7 +64,8 @@ class NotificationDispatcher: print("Error: Invalid message format") async def dispatch(self, ticket, event_id, new): - message = render_notification_new_ticket(ticket) if new else render_notification_reply_ticket(ticket) + message = database_sync_to_async(render_notification_new_ticket)(ticket) if new else database_sync_to_async( + render_notification_reply_ticket)(ticket) print("Dispatching message:", message, "with event_id:", event_id) targets = await self.get_notification_targets() await telegram_notify(message, TELEGRAM_GROUP_CHAT_ID)