Pass valid ticket type to Zendesk

The feedback endpoints use `ticket_type` to decide what to display and
whether or not a ticket should be escalated. We were using the
ticket_type as the value for the Zendesk ticket_type. However, the Zendesk
API accepts 4 values for its ticket_type and these are different from
the ticket_type values we use in our code.

This change converts the Notify ticket_type value to a valid Zendesk
ticket_type value when creating a Notify feedback ticket.
This commit is contained in:
Katie Smith
2021-09-24 11:37:28 +01:00
parent 437af32d82
commit a54b3c9f77
2 changed files with 38 additions and 19 deletions

View File

@@ -130,7 +130,7 @@ def feedback(ticket_type):
ticket = NotifySupportTicket(
subject='Notify feedback',
message=feedback_msg,
ticket_type=ticket_type,
ticket_type=get_zendesk_ticket_type(ticket_type),
p1=out_of_hours_emergency,
user_name=user_name,
user_email=user_email,
@@ -231,3 +231,14 @@ def needs_escalation(ticket_type, severe):
not current_user.is_authenticated,
not in_business_hours(),
))
def get_zendesk_ticket_type(ticket_type):
# Zendesk has 4 ticket types - "problem", "incident", "task" and "question".
# We don't want to use a Zendesk "problem" ticket type when someone reports a
# Notify problem because they are designed to group multiple incident tickets together,
# allowing them to be solved as a group.
if ticket_type == PROBLEM_TICKET_TYPE:
return NotifySupportTicket.TYPE_INCIDENT
return NotifySupportTicket.TYPE_QUESTION