new_ticket_done signal emitted through email

This commit is contained in:
Sam Splunks 2024-04-17 10:19:50 +00:00
parent 81f9226f7c
commit 2fc95d165a

View File

@ -24,7 +24,7 @@ from helpdesk import settings
from helpdesk.exceptions import DeleteIgnoredTicketException, IgnoreTicketException from helpdesk.exceptions import DeleteIgnoredTicketException, IgnoreTicketException
from helpdesk.lib import process_attachments, safe_template_context from helpdesk.lib import process_attachments, safe_template_context
from helpdesk.models import FollowUp, IgnoreEmail, Queue, Ticket from helpdesk.models import FollowUp, IgnoreEmail, Queue, Ticket
from helpdesk.signals import update_ticket_done from helpdesk.signals import new_ticket_done, update_ticket_done
import imaplib import imaplib
import logging import logging
import mimetypes import mimetypes
@ -617,7 +617,10 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger)
"Message seems to be auto-reply, not sending any emails back to the sender") "Message seems to be auto-reply, not sending any emails back to the sender")
else: else:
send_info_email(message_id, f, ticket, context, queue, new) send_info_email(message_id, f, ticket, context, queue, new)
if not new: if new:
# emit signal when the PublicTicketForm.save is done
new_ticket_done.send(sender="create_object_from_email_message", ticket=ticket)
else:
# emit signal with followup when the ticket is updated # emit signal with followup when the ticket is updated
update_ticket_done.send(sender="create_object_from_email_message", followup=f) update_ticket_done.send(sender="create_object_from_email_message", followup=f)
return ticket return ticket