Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set HX user_data parameter as flow name #400

Merged
merged 5 commits into from
Jan 25, 2022
Merged

Set HX user_data parameter as flow name #400

merged 5 commits into from
Jan 25, 2022

Conversation

norkans7
Copy link
Contributor

@norkans7 norkans7 commented Jan 18, 2022

@codecov
Copy link

codecov bot commented Jan 18, 2022

Codecov Report

Merging #400 (950141d) into main (cbfd24d) will decrease coverage by 0.07%.
The diff coverage is 42.10%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #400      +/-   ##
==========================================
- Coverage   72.02%   71.95%   -0.08%     
==========================================
  Files          95       95              
  Lines        8330     8348      +18     
==========================================
+ Hits         6000     6007       +7     
- Misses       1736     1747      +11     
  Partials      594      594              
Impacted Files Coverage Δ
handlers/test.go 0.00% <0.00%> (ø)
msg.go 33.33% <ø> (ø)
test.go 32.20% <0.00%> (-1.00%) ⬇️
backends/rapidpro/msg.go 69.09% <87.50%> (+0.69%) ⬆️
handlers/highconnection/highconnection.go 87.50% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update cbfd24d...950141d. Read the comment docs.

@rowanseymour
Copy link
Member

@norkans7 @ericnewcomer maybe before fixing this, we start queuing messages in mailroom with their flow name and use that?

@norkans7
Copy link
Contributor Author

Sure, I had just assumed that was broken because the parameter was changed(or we had that wrong all the time)

@rowanseymour
Copy link
Member

I can make the change on the mailroom side but are we good with flow name? UUID? I'm leaning toward name..

@norkans7
Copy link
Contributor Author

I think mailroom sends both the same as the archiver so we are very specific and HX we can only send one of those if that is what is needed

Copy link
Member

@ericnewcomer ericnewcomer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We actually want to change the user_data param to be the flow name

@norkans7 norkans7 requested a review from ericnewcomer January 19, 2022 09:57
@@ -518,6 +518,8 @@ type DBMsg struct {
SessionWaitStartedOn_ *time.Time `json:"session_wait_started_on,omitempty"`
SessionStatus_ string `json:"session_status,omitempty"`

Flow_ json.RawMessage `json:"flow,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no reason to not parse it all in one go.. you can even use a anon struct like

Flow_ *struct {
    UUID string `json:"uuid"`
    Name string `json:"name"`
} `json:"flow"`
``

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What type will Flow() will return there?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

never mind no need for anymore

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you need a type just add something like MsgFlowRef

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am confused on how to use that I will try that again tomorrow

"to": "+250788383383",
"ret_id": "10",
"datacoding": "8",
"user_data": "",
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A message not from a flow will have the user_data as empty string

msg.go Outdated
Name string `json:"name"`
}

var NilMsgFlowRef = MsgFlowRef{"", ""}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We don't want to serialize messages with "flow": {"uuid": "", "name": ""}.. should be a pointer on Msg which can be nil if there's no flow.

While you're changing this let's call it just FlowReference for simplicity and consistency with mailroom/goflow.

@norkans7 norkans7 requested a review from rowanseymour January 24, 2022 08:10
handlers/test.go Outdated
Flow *struct {
UUID string
Name string
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not use the FlowReference type here?

Flow: &struct {
UUID string
Name string
}{UUID: "9de3663f-c5c5-4c92-9f45-ecbc09abcc85", Name: "Favorites"},
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use FlowReference type

@rowanseymour rowanseymour changed the title Update HX user_data parameter Set HX user_data parameter as flow name Jan 25, 2022
@rowanseymour rowanseymour merged commit be4b48c into main Jan 25, 2022
@rowanseymour rowanseymour deleted the update-HX branch January 25, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants