UPDATED: after processing an email message, if there's any TicketCC instance linked to the Ticket being handled, mail them all.

This commit is contained in:
Bruno Tikami 2016-02-20 12:39:16 -02:00
parent 5ed6e8c2ce
commit 75a5556317

View File

@ -36,7 +36,7 @@ except ImportError:
from datetime import datetime as timezone from datetime import datetime as timezone
from helpdesk.lib import send_templated_mail, safe_template_context from helpdesk.lib import send_templated_mail, safe_template_context
from helpdesk.models import Queue, Ticket, FollowUp, Attachment, IgnoreEmail from helpdesk.models import Queue, Ticket, TicketCC, FollowUp, Attachment, IgnoreEmail
class Command(BaseCommand): class Command(BaseCommand):
@ -184,6 +184,7 @@ def create_ticket_cc(ticket, cc_list):
ticket_cc = subscribe_to_ticket_updates(ticket=ticket, user=user, email=cced_email) ticket_cc = subscribe_to_ticket_updates(ticket=ticket, user=user, email=cced_email)
def create_object_from_email_message(message, ticket_id, payload, files, quiet): def create_object_from_email_message(message, ticket_id, payload, files, quiet):
ticket, previous_followup, new = None, None, False ticket, previous_followup, new = None, None, False
@ -271,6 +272,18 @@ def create_object_from_email_message(message, ticket_id, payload, files, quiet):
if cc_list is not None: if cc_list is not None:
create_ticket_cc(ticket, cc_list.split(',')) create_ticket_cc(ticket, cc_list.split(','))
ticket_cc_list = TicketCC.objects.filter(ticket=ticket).all().values_list('email', flat=True)
if ticket_cc_list.count() > 0 :
send_templated_mail(
'newticket_cc',
context,
recipients=ticket_cc_list,
sender=queue.from_address,
fail_silently=True,
extra_headers={'In-Reply-To': message_id},
)
if new: if new:
if sender_email: if sender_email: