stash
This commit is contained in:
parent
a8a3c36fab
commit
ce11d2dff1
1 changed files with 2 additions and 3 deletions
|
@ -43,7 +43,7 @@ class NotificationDispatcher:
|
||||||
|
|
||||||
@database_sync_to_async
|
@database_sync_to_async
|
||||||
def get_ticket(self, ticket_id):
|
def get_ticket(self, ticket_id):
|
||||||
return IssueThread.objects.get(id=ticket_id)
|
return IssueThread.objects.get(id=ticket_id).prefetch_related('event')
|
||||||
|
|
||||||
async def run_forever(self):
|
async def run_forever(self):
|
||||||
# Infinite loop to continuously listen for messages
|
# Infinite loop to continuously listen for messages
|
||||||
|
@ -64,8 +64,7 @@ class NotificationDispatcher:
|
||||||
print("Error: Invalid message format")
|
print("Error: Invalid message format")
|
||||||
|
|
||||||
async def dispatch(self, ticket, event_id, new):
|
async def dispatch(self, ticket, event_id, new):
|
||||||
message = database_sync_to_async(render_notification_new_ticket)(ticket) if new else database_sync_to_async(
|
message = render_notification_new_ticket(ticket) if new else await render_notification_reply_ticket(ticket)
|
||||||
render_notification_reply_ticket)(ticket)
|
|
||||||
print("Dispatching message:", message, "with event_id:", event_id)
|
print("Dispatching message:", message, "with event_id:", event_id)
|
||||||
targets = await self.get_notification_targets()
|
targets = await self.get_notification_targets()
|
||||||
await telegram_notify(message, TELEGRAM_GROUP_CHAT_ID)
|
await telegram_notify(message, TELEGRAM_GROUP_CHAT_ID)
|
||||||
|
|
Loading…
Reference in a new issue