From 6c440f3ed0ad2f89cf396ed398429c0cc2c17179 Mon Sep 17 00:00:00 2001 From: Ross Poulton Date: Mon, 21 Jan 2013 17:25:14 +1100 Subject: [PATCH] Fix #160 - send e-mails to ticket CC list even if there is no ticket submitter --- helpdesk/views/staff.py | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 76a8242f..12b301b6 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -483,7 +483,8 @@ def update_ticket(request, ticket_id, public=False): comment=f.comment, ) - if ticket.submitter_email and public and (f.comment or (f.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS))): + if public and (f.comment or (f.new_status in (Ticket.RESOLVED_STATUS, Ticket.CLOSED_STATUS))): + if f.new_status == Ticket.RESOLVED_STATUS: template = 'resolved_submitter' @@ -492,15 +493,16 @@ def update_ticket(request, ticket_id, public=False): else: template = 'updated_submitter' - send_templated_mail( - template, - context, - recipients=ticket.submitter_email, - sender=ticket.queue.from_address, - fail_silently=True, - files=files, - ) - messages_sent_to.append(ticket.submitter_email) + if ticket.submitter_email: + send_templated_mail( + template, + context, + recipients=ticket.submitter_email, + sender=ticket.queue.from_address, + fail_silently=True, + files=files, + ) + messages_sent_to.append(ticket.submitter_email) for cc in ticket.ticketcc_set.all(): if cc.email_address not in messages_sent_to: