Add a signal when the ticket upate is done (every related instance created and updated)

This commit is contained in:
Sam Splunks 2024-04-16 08:04:01 +00:00
parent 8fffae343c
commit 2499f81d4d

View File

@ -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)