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

Include comments message in payload #14259

Merged
merged 5 commits into from
Sep 4, 2024
Merged

Conversation

britneywwc
Copy link
Contributor

@britneywwc britneywwc commented Sep 3, 2024

Done

  • Previously commentsFromLead wasn't being added to the payload
  • Added a check to add commentsFromLead to payload if value isn't empty
  • Run linter on /templates/shared/forms/interactive/kafka.html

QA

Issue / Card

Fixes WD-14649

Screenshots

[If relevant, please include a screenshot.]

Help

QA steps - Commit guidelines

@webteam-app
Copy link

@britneywwc britneywwc changed the title Include comments to payload message Include comments message in payload Sep 3, 2024
Copy link

codecov bot commented Sep 3, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 69.63%. Comparing base (a7d980c) to head (dcc3d37).
Report is 39 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #14259      +/-   ##
==========================================
+ Coverage   69.57%   69.63%   +0.05%     
==========================================
  Files         120      120              
  Lines        3412     3418       +6     
  Branches     1176     1174       -2     
==========================================
+ Hits         2374     2380       +6     
  Misses       1013     1013              
  Partials       25       25              

see 1 file with indirect coverage changes

@petesfrench
Copy link
Contributor

I tested this on another form, https://ubuntu-com-14259.demos.haus/ai#get-in-touch, and the comments_from_lead fields were duplicated
image
This wasn't the case on the live site (although they look a little broken there also)
image

@britneywwc
Copy link
Contributor Author

Thanks @petesfrench, I've updated the ai and kafka forms to ensure that the payload includes the comments correctly.

I think moving forward, whichever formfield that does not have "name" attributes should be encapsulated within a <div class="js-formfield"> to format the form title and input value correctly. The dynamic-forms createMessage() function will consolidate all the form titles and values into Comments_for_lead__c.

I updated the kafka forms so that Comments_for_lead__c is hidden and the message payload will be added on submit. Otherwise, the textarea will act undesirably once the form is invoked due to the createMessage() being called on form initialisation.

@petesfrench
Copy link
Contributor

@britneywwc Yes, that is exactly how dynamic-forms work. It might be worth while added a sort readme to the top of the dynamic-forms file, as this is often a source of problems.

@britneywwc
Copy link
Contributor Author

I've added some docstring to the dynamic-forms file. Let me know if I've missed out anything crucial.

Copy link
Contributor

@petesfrench petesfrench left a comment

Choose a reason for hiding this comment

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

Awesome work @britneywwc! LGTM!

@britneywwc britneywwc merged commit 70ec4dc into canonical:main Sep 4, 2024
16 checks passed
@britneywwc britneywwc deleted the forms-kafka branch September 4, 2024 09:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants