From 2499f81d4dc964924deb6cadee9ff6c1e21ee836 Mon Sep 17 00:00:00 2001 From: Sam Splunks <72095718+samsplunks@users.noreply.github.com> Date: Tue, 16 Apr 2024 08:04:01 +0000 Subject: [PATCH] Add a signal when the ticket upate is done (every related instance created and updated) --- helpdesk/update_ticket.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/helpdesk/update_ticket.py b/helpdesk/update_ticket.py index f10a33d5..ddd337ee 100644 --- a/helpdesk/update_ticket.py +++ b/helpdesk/update_ticket.py @@ -4,6 +4,7 @@ from django.core.exceptions import ValidationError from django.contrib.auth import get_user_model from django.utils import timezone from django.utils.translation import gettext as _ +import django.dispatch from helpdesk.lib import safe_template_context from helpdesk import settings as helpdesk_settings @@ -20,6 +21,8 @@ from helpdesk.models import ( User = get_user_model() +update_ticket_done = django.dispatch.Signal() + def add_staff_subscription( user: User, ticket: Ticket @@ -387,6 +390,9 @@ def update_ticket( )) ticket.save() + # emit signal with followup when the ticket update is done + update_ticket_done.send(sender="update_ticket", followup=f) + from helpdesk.webhooks import notify_followup_webhooks notify_followup_webhooks(f)