From 0a3171a024de14ad46b142d2d8bb4ab64edb4547 Mon Sep 17 00:00:00 2001 From: "vlad.vyazovetskov" Date: Thu, 12 Nov 2015 17:31:14 +0300 Subject: [PATCH 1/2] From gettatr to get, because dict doesn't contatin attributes. More readable if statement. --- helpdesk/views/api.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/helpdesk/views/api.py b/helpdesk/views/api.py index 341337ac..bb80e701 100644 --- a/helpdesk/views/api.py +++ b/helpdesk/views/api.py @@ -202,7 +202,7 @@ class API: context = safe_template_context(ticket) context['comment'] = f.comment - + messages_sent_to = [] if public and ticket.submitter_email: @@ -237,14 +237,20 @@ class API: ) messages_sent_to.append(ticket.queue.updated_ticket_cc) - if ticket.assigned_to and self.request.user != ticket.assigned_to and getattr(ticket.assigned_to.usersettings.settings, 'email_on_ticket_apichange', False) and ticket.assigned_to.email and ticket.assigned_to.email not in messages_sent_to: + if ( + ticket.assigned_to and + self.request.user != ticket.assigned_to and + ticket.assigned_to.usersettings.settings.get('email_on_ticket_apichange', False) and + ticket.assigned_to.email and + ticket.assigned_to.email not in messages_sent_to + ): send_templated_mail( 'updated_owner', context, recipients=ticket.assigned_to.email, sender=ticket.queue.from_address, fail_silently=True, - ) + ) ticket.save() @@ -276,7 +282,7 @@ class API: context['resolution'] = f.comment subject = '%s %s (Resolved)' % (ticket.ticket, ticket.title) - + messages_sent_to = [] if ticket.submitter_email: From 98ad8567b90123da0d9048856aad9a4821c618f8 Mon Sep 17 00:00:00 2001 From: Scott Sadler Date: Thu, 12 Nov 2015 15:53:16 +0100 Subject: [PATCH 2/2] Include attachments to cc'd users on ticket update --- helpdesk/views/staff.py | 1 + 1 file changed, 1 insertion(+) diff --git a/helpdesk/views/staff.py b/helpdesk/views/staff.py index 812644b3..f904ae40 100644 --- a/helpdesk/views/staff.py +++ b/helpdesk/views/staff.py @@ -508,6 +508,7 @@ def update_ticket(request, ticket_id, public=False): recipients=cc.email_address, sender=ticket.queue.from_address, fail_silently=True, + files=files, ) messages_sent_to.append(cc.email_address)