Use update_ticket mechanism in email.py

This commit is contained in:
Sam Splunks 2024-04-16 08:49:11 +00:00
parent 79b7ce9650
commit c0ee8e0847
2 changed files with 4 additions and 3 deletions

View File

@ -25,6 +25,7 @@ from helpdesk import webhooks
from helpdesk.exceptions import DeleteIgnoredTicketException, IgnoreTicketException
from helpdesk.lib import process_attachments, safe_template_context
from helpdesk.models import FollowUp, IgnoreEmail, Queue, Ticket
from helpdesk.signals import update_ticket_done
import imaplib
import logging
import mimetypes
@ -618,7 +619,8 @@ def create_object_from_email_message(message, ticket_id, payload, files, logger)
else:
send_info_email(message_id, f, ticket, context, queue, new)
if not new:
webhooks.notify_followup_webhooks(f)
# emit signal with followup when the ticket is updated
update_ticket_done.send(sender="create_object_from_email_message", followup=f)
return ticket

View File

@ -36,8 +36,7 @@ def notify_followup_webhooks(followup):
# listener is loaded via app.py HelpdeskConfig.ready()
@receiver(update_ticket_done)
def notify_followup_webhooks_receiver(sender, followup, **kwargs):
if sender == "update_ticket":
notify_followup_webhooks(followup)
notify_followup_webhooks(followup)
def send_new_ticket_webhook(ticket):