Make update_ticket_done signal trigger notify_followup_webhooks

This commit is contained in:
Sam Splunks
2024-04-16 08:23:06 +00:00
parent 2499f81d4d
commit ebb9a4d50d
3 changed files with 30 additions and 25 deletions

View File

@ -4,7 +4,6 @@ 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
@ -18,11 +17,10 @@ from helpdesk.models import (
TicketCC,
TicketChange,
)
from helpdesk.signals import update_ticket_done
User = get_user_model()
update_ticket_done = django.dispatch.Signal()
def add_staff_subscription(
user: User,
ticket: Ticket
@ -391,11 +389,9 @@ def update_ticket(
ticket.save()
# emit signal with followup when the ticket update is done
# internally used for webhooks
update_ticket_done.send(sender="update_ticket", followup=f)
from helpdesk.webhooks import notify_followup_webhooks
notify_followup_webhooks(f)
# auto subscribe user if enabled
add_staff_subscription(user, ticket)
return f