Redo submitter notification logic with clearer understanding of

implementation.
This commit is contained in:
Christopher Broderick
2025-07-27 12:03:43 +01:00
parent 850e348107
commit 8776fa4d93

View File

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