stash
This commit is contained in:
parent
163de03d56
commit
1e448a3137
1 changed files with 8 additions and 7 deletions
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue