From 016143c109f4eed11336dfdb8a68c05234c29bae Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 26 Apr 2024 01:28:44 +0200 Subject: [PATCH] stash --- core/mail/notifications.py | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/core/mail/notifications.py b/core/mail/notifications.py index 36120aa..02c46d1 100644 --- a/core/mail/notifications.py +++ b/core/mail/notifications.py @@ -20,10 +20,11 @@ class NotificationDispatcher: # Blocking receive to get the message from the channel layer message = await self.channel_layer.receive(channel_name) - if message: - # Process the received message - print("Received message:", message) - await self.dispatch(message) + if (message and 'type' in message and message['type'] == 'generic.event' and 'name' in message and + message['name'] == 'user_notification'): + if 'message' in message and 'event_id' in message: + print("Received message:", message['message'], "with event_id:", message['event_id']) + await self.dispatch(message['message'], message['event_id']) - async def dispatch(self, message): - print("Dispatching message:", message) + async def dispatch(self, message, event_id): + print("Dispatching message:", message, "with event_id:", event_id)