This commit is contained in:
j3d1 2024-05-04 02:49:36 +02:00
parent d7a383f1e7
commit 42509388bd
2 changed files with 21 additions and 16 deletions

View file

@ -22,8 +22,8 @@ async def telegram_notify(message, chat_id):
return await http_get(url)
async def email_notify(message, email):
mail = make_notification(message, email)
async def email_notify(message, title, email):
mail = make_notification(message, email, title)
await send_smtp(mail)
@ -66,6 +66,7 @@ class NotificationDispatcher:
async def dispatch(self, ticket, event_id, new):
message = await render_notification_new_ticket_async(
ticket) if new else await render_notification_reply_ticket_async(ticket)
title = f"{ticket.name} [#{ticket.short_uuid()}]"
print("Dispatching message:", message, "with event_id:", event_id)
targets = await self.get_notification_targets()
# await telegram_notify(message, TELEGRAM_GROUP_CHAT_ID)
@ -75,6 +76,6 @@ class NotificationDispatcher:
await telegram_notify(message, target.channel_target)
elif target.channel_type == 'email':
print("Sending email notification to:", target.channel_target)
await email_notify(message, target.channel_target)
await email_notify(message, title, target.channel_target)
else:
print("Unknown channel type:", target.channel_type)