Skip to content

Commit

Permalink
Support Spanish status names passed back from Zendesk targets
Browse files Browse the repository at this point in the history
  • Loading branch information
rowanseymour committed Sep 6, 2021
1 parent a827881 commit ac1060f
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
23 changes: 23 additions & 0 deletions services/tickets/zendesk/testdata/target.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
]
}
]
4 changes: 2 additions & 2 deletions services/tickets/zendesk/web.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down

0 comments on commit ac1060f

Please sign in to comment.