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

Fix WA button url #715

Merged
merged 3 commits into from
Mar 15, 2024
Merged

Fix WA button url #715

merged 3 commits into from
Mar 15, 2024

Conversation

norkans7
Copy link
Contributor

No description provided.

Copy link

codecov bot commented Mar 15, 2024

Codecov Report

Attention: Patch coverage is 0% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 74.19%. Comparing base (db7ae80) to head (4a570e6).
Report is 2 commits behind head on main.

Files Patch % Lines
handlers/meta/whatsapp/templates.go 0.00% 2 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #715   +/-   ##
=======================================
  Coverage   74.19%   74.19%           
=======================================
  Files         110      110           
  Lines       13325    13325           
=======================================
  Hits         9887     9887           
  Misses       2722     2722           
  Partials      716      716           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@norkans7 norkans7 changed the title Fix wa button url Fix WA button url Mar 15, 2024
component := &Component{Type: "button", Index: strings.TrimPrefix(k, "button."), SubType: "quick_reply"}
component.Params = append(component.Params, &Param{Type: "url", Text: p.Value})
component.Params = append(component.Params, &Param{Type: "text", Text: p.Value})
Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -52,9 +52,9 @@ func GetTemplatePayload(templating MsgTemplating) *Template {
if strings.HasPrefix(k, "button.") {

for _, p := range v {
if strings.HasPrefix(p.Value, "http") {
if p.Type == "url" || strings.HasPrefix(p.Value, "http") {
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 update to have the url type for the param on rapidpro when syncing the templates
nyaruka/rapidpro#5107

and the engine will pass that without changing it https://github.com/nyaruka/goflow/blob/b07f34a76065cea43070b0b0a2c509772a346ad8/flows/actions/send_msg.go#L168

Copy link
Member

Choose a reason for hiding this comment

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

Why do we need || strings.HasPrefix(p.Value, "http") ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That is what was there, so I did not want to remove that since the docs are not clear for every case,
I think that was added from trials and errors too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But also I doubt that has ever worked since the we used payload and not text

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually I can remove that since the type url is an invalid value there

@norkans7 norkans7 requested a review from rowanseymour March 15, 2024 12:33
@rowanseymour rowanseymour merged commit 6f4016f into main Mar 15, 2024
6 of 7 checks passed
@rowanseymour rowanseymour deleted the fix-WA-button-url branch March 15, 2024 13:18
@github-actions github-actions bot locked and limited conversation to collaborators Mar 15, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants