From c1e7a8910da64ff7a24dbbd69f90397ea93b0485 Mon Sep 17 00:00:00 2001 From: jedi Date: Fri, 26 Apr 2024 00:18:04 +0200 Subject: [PATCH] stash --- core/mail/protocol.py | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/core/mail/protocol.py b/core/mail/protocol.py index 25981b5..93ea9f0 100644 --- a/core/mail/protocol.py +++ b/core/mail/protocol.py @@ -249,13 +249,13 @@ Your c3lf (Cloakroom + Lost&Found) Team'''.format(active_issue_thread.short_uuid active_issue_thread.state = 'pending_open' active_issue_thread.save() - notifcation = None + notification = None if new: - notifcation = f"New issue {active_issue_thread.short_uuid()} created by {sender}" + notification = f"New issue {active_issue_thread.short_uuid()} created by {sender}" else: - notifcation = f"Reply to issue {active_issue_thread.short_uuid()} by {sender}" + notification = f"Reply to issue {active_issue_thread.short_uuid()} by {sender}" - return email, new, reply, notifcation + return email, new, reply, notification class LMTPHandler: @@ -277,7 +277,7 @@ class LMTPHandler: content = None try: content = envelope.content - email, new, reply = await receive_email(envelope, log) + email, new, reply, notification = await database_sync_to_async(receive_email)(envelope, log) log.info(f"Created email {email.id}") systemevent = await database_sync_to_async(SystemEvent.objects.create)(type='email received', reference=email.id) @@ -287,10 +287,11 @@ class LMTPHandler: 'general', {"type": "generic.event", "name": "send_message_to_frontend", "event_id": systemevent.id, "message": "email received"}) log.info(f"Sent message to frontend") - if notifcation: + if notification: + log.info(f"Sending notification {notification}") await channel_layer.group_send( 'general', {"type": "generic.event", "name": "user_notification", "event_id": systemevent.id, - "message": notifcation}) + "message": notification}) if new and reply: log.info('Sending message to %s' % reply['To']) await send_smtp(reply)