Skip to content

Commit

Permalink
make sure to add contact to group in local flow state
Browse files Browse the repository at this point in the history
  • Loading branch information
nicpottier committed May 30, 2017
1 parent a8096b1 commit 81296b5
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 9 deletions.
2 changes: 1 addition & 1 deletion cmd/flowrunner/testdata/contacts/default.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
{
"uuid": "contact1-test-4b7f-a34b-e37e31e86451",
"name": "Ben Haggerty",
"language": "eng",
Expand Down
4 changes: 2 additions & 2 deletions cmd/flowrunner/testdata/flows/all_actions.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@
"type": "remove_from_group",
"groups": [
{
"uuid": "b7cf0d83-f1c9-411c-96fd-c511a4cfa86d",
"name": "Registered Users"
"uuid": "2aad21f6-30b7-42c5-bd7f-1b720c154817",
"name": "Survey Audience"
}
]
},
Expand Down
26 changes: 24 additions & 2 deletions cmd/flowrunner/testdata/flows/all_actions_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,17 @@
"urn": "tel:+12065551212",
"text": "Hi Ben Haggerty, are you ready?"
},
{
"type": "remove_from_group",
"groups": [
{
"uuid": "",
"name": "Survey Audience"
}
],
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"step": ""
},
{
"type": "msg_out",
"created_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down Expand Up @@ -103,7 +114,7 @@
}
],
"status": "C",
"child": "c9943827-b80b-4e22-8e46-6be598049f4e",
"child": "0a020b41-fe73-4bd2-ae79-62efd9af5a98",
"results": {
"gender": {
"node": "node1",
Expand All @@ -126,7 +137,7 @@
"contact": "contact1-test-4b7f-a34b-e37e31e86451",
"path": [],
"status": "C",
"parent": "746ab857-7354-4aa9-8b16-a9b62d23c4aa",
"parent": "2963771a-2b7a-4b99-86aa-3ab76c769408",
"results": {},
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"modified_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down Expand Up @@ -186,6 +197,17 @@
"urn": "tel:+12065551212",
"text": "Hi Ben Haggerty, are you ready?"
},
{
"type": "remove_from_group",
"groups": [
{
"uuid": "",
"name": "Survey Audience"
}
],
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"step": ""
},
{
"type": "msg_out",
"created_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down
8 changes: 4 additions & 4 deletions cmd/flowrunner/testdata/flows/subflow_test.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"type": "flow",
"flow": "flow2"
},
"child": "ec00435a-38a7-499a-9bf3-0ae8796d5e06",
"child": "3f206963-8c04-4e04-b7f1-236389fe29d1",
"results": {},
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"modified_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down Expand Up @@ -92,7 +92,7 @@
"wait": {
"type": "msg"
},
"parent": "b891f53a-9f65-400b-9d48-7fcbfba55e5e",
"parent": "bf32954c-3278-457b-82c5-997fee8c375d",
"results": {},
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"modified_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down Expand Up @@ -213,7 +213,7 @@
"contact": "contact1-test-4b7f-a34b-e37e31e86451",
"text": "Ryan Lewis"
},
"parent": "b891f53a-9f65-400b-9d48-7fcbfba55e5e",
"parent": "bf32954c-3278-457b-82c5-997fee8c375d",
"results": {
"name": {
"node": "flow2-node1",
Expand Down Expand Up @@ -290,7 +290,7 @@
}
],
"status": "C",
"child": "ec00435a-38a7-499a-9bf3-0ae8796d5e06",
"child": "3f206963-8c04-4e04-b7f1-236389fe29d1",
"results": {},
"created_on": "2000-01-01T00:00:00.000000000-00:00",
"modified_on": "2000-01-01T00:00:00.000000000-00:00",
Expand Down
1 change: 1 addition & 0 deletions flows/actions/add_to_group.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ func (a *AddToGroupAction) Execute(run flows.FlowRun, step flows.Step) error {
groups := make([]*flows.Group, 0, len(a.Groups))
for _, group := range a.Groups {
if contact.Groups().FindGroup(group.UUID()) == nil {
contact.AddGroup(group.UUID(), group.Name())
groups = append(groups, group)
}

Expand Down

0 comments on commit 81296b5

Please sign in to comment.