Skip to content

Commit

Permalink
Fix legacy WA components parameters
Browse files Browse the repository at this point in the history
  • Loading branch information
norkans7 committed Jun 14, 2024
1 parent 03a119f commit e4adb29
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion handlers/whatsapp_legacy/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -726,7 +726,7 @@ func buildPayloads(msg courier.MsgOut, h *handler, clog *courier.ChannelLog) ([]
compParams = append(compParams, msg.Templating().Variables[comp.Variables[varName]])
}

if comp.Type == "body" {
if comp.Type == "body" || strings.HasPrefix(comp.Type, "body/") {
component := &Component{Type: "body"}
for _, p := range compParams {
component.Parameters = append(component.Parameters, Param{Type: p.Type, Text: p.Value})
Expand Down
8 changes: 4 additions & 4 deletions handlers/whatsapp_legacy/handler_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -772,7 +772,7 @@ var defaultSendTestCases = []OutgoingTestCase{
MsgTemplating: `{
"template": {"uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3", "name": "revive_issue"},
"components": [
{"type": "body", "name": "body", "variables": {"1": 0, "2": 1}}
{"type": "body/text", "name": "body", "variables": {"1": 0, "2": 1}}
],
"variables": [
{"type": "text", "value": "Chef"},
Expand Down Expand Up @@ -821,7 +821,7 @@ var defaultSendTestCases = []OutgoingTestCase{
MsgTemplating: `{
"template": {"uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3", "name": "revive_issue"},
"components": [
{"type": "body", "name": "body", "variables": {"1": 0, "2": 1}}
{"type": "body/text", "name": "body", "variables": {"1": 0, "2": 1}}
],
"variables": [
{"type": "text", "value": "Chef"},
Expand Down Expand Up @@ -849,7 +849,7 @@ var defaultSendTestCases = []OutgoingTestCase{
"template": {"uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3", "name": "revive_issue"},
"namespace": "wa_template_namespace",
"components": [
{"type": "body", "name": "body", "variables": {"1": 0, "2": 1}}
{"type": "body/text", "name": "body", "variables": {"1": 0, "2": 1}}
],
"variables": [
{"type": "text", "value": "Chef"},
Expand All @@ -876,7 +876,7 @@ var defaultSendTestCases = []OutgoingTestCase{
MsgTemplating: `{
"template": {"uuid": "171f8a4d-f725-46d7-85a6-11aceff0bfe3", "name": "revive_issue"},
"components": [
{"type": "body", "name": "body", "variables": {"1": 0, "2": 1}}
{"type": "body/text", "name": "body", "variables": {"1": 0, "2": 1}}
],
"variables": [
{"type": "text", "value": "Chef"},
Expand Down

0 comments on commit e4adb29

Please sign in to comment.