From ac1060ff8ed366e4faa165aedb017386f3c51744 Mon Sep 17 00:00:00 2001 From: Rowan Seymour Date: Mon, 6 Sep 2021 16:24:00 -0500 Subject: [PATCH] Support Spanish status names passed back from Zendesk targets --- services/tickets/zendesk/testdata/target.json | 23 +++++++++++++++++++ services/tickets/zendesk/web.go | 4 ++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/services/tickets/zendesk/testdata/target.json b/services/tickets/zendesk/testdata/target.json index a10bd4961..3e237dc17 100644 --- a/services/tickets/zendesk/testdata/target.json +++ b/services/tickets/zendesk/testdata/target.json @@ -105,5 +105,28 @@ "count": 1 } ] + }, + { + "label": "ticket updated also when status is non-English", + "method": "POST", + "path": "/mr/tickets/types/zendesk/target/4ee6d4f3-f92b-439b-9718-8da90c05490b", + "headers": { + "Authorization": "Basic emVuZGVzazpzZXNhbWU=" + }, + "body": { + "event": "status_changed", + "id": 1234, + "status": "Abierto" + }, + "status": 200, + "response": { + "status": "handled" + }, + "db_assertions": [ + { + "query": "select count(*) from tickets_ticket where status = 'O'", + "count": 1 + } + ] } ] \ No newline at end of file diff --git a/services/tickets/zendesk/web.go b/services/tickets/zendesk/web.go index 0f7c9bdae..a364b9b89 100644 --- a/services/tickets/zendesk/web.go +++ b/services/tickets/zendesk/web.go @@ -283,9 +283,9 @@ func handleTicketerTarget(ctx context.Context, rt *runtime.Runtime, r *http.Requ if request.Event == "status_changed" { switch strings.ToLower(request.Status) { - case statusSolved, statusClosed: + case statusSolved, statusClosed, "resuelto", "cerrado": err = tickets.CloseTicket(ctx, rt, nil, ticket, false, l) - case statusOpen: + case statusOpen, "abierto": err = tickets.ReopenTicket(ctx, rt, nil, ticket, false, l) }