From 8776fa4d935bf960b111320bfd7224b9dcad074e Mon Sep 17 00:00:00 2001 From: Christopher Broderick Date: Sun, 27 Jul 2025 12:03:43 +0100 Subject: [PATCH] Redo submitter notification logic with clearer understanding of implementation. --- helpdesk/update_ticket.py | 27 ++++----------------------- 1 file changed, 4 insertions(+), 23 deletions(-) diff --git a/helpdesk/update_ticket.py b/helpdesk/update_ticket.py index 94bd5fad..a2d83b41 100644 --- a/helpdesk/update_ticket.py +++ b/helpdesk/update_ticket.py @@ -138,34 +138,15 @@ def process_email_notifications_for_ticket_update( Sends email notifications when the ticket is updated in any way. """ template_prefix = get_email_template_prefix(reassigned, follow_up) - roles = {} - if public and ( + if helpdesk_settings.HELPDESK_NOTIFY_SUBMITTER_FOR_ALL_TICKET_CHANGES or (public and ( follow_up.comment - or (follow_up.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS)) + or (follow_up.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS))) ): - # For public tickets we do not want to send the assigned template for backwards compatibility + # Use hard coded prefix for submitter updates on tickets for backwards compatibility # TODO: possibly make the template prefix modification configurable - pub_template_prefix = ( - "updated_" if template_prefix == "assigned_" else template_prefix - ) - roles.update( - { - "submitter": (pub_template_prefix + "submitter", context), - "ticket_cc": (pub_template_prefix + "cc", context), - } - ) - else: - if helpdesk_settings.HELPDESK_SEND_EMAIL_NOTIFICATION_FOR_INTERNAL_TICKET_UPDATES: - roles.update( - { - "submitter": (template_prefix + "submitter", context), - } - ) - - if roles: messages_sent_to.update( ticket.send( - roles, + {"submitter": ("update_submitter", context),}, dont_send_to=messages_sent_to, fail_silently=True, files=files,