Skip to content

Conversation

shinde-rahul
Copy link
Contributor

@shinde-rahul shinde-rahul commented May 13, 2025

Q A
Bug fix? (use the a.b branch)
New feature/enhancement? (use the a.x branch) ✔️
Deprecations?
BC breaks? (use the c.x branch)
Automated tests included? ✔️
Related user documentation PR URL mautic/user-documentation#...
Related developer documentation PR URL mautic/developer-documentation-new#...
Issue(s) addressed Fixes #...

Description

Currently, when inserting form result tokens into the message field of the "Send form results" action, only the values are included. This makes it difficult to understand the context of each value in the resulting email. This update modifies the token insertion to include both the field label and value, improving clarity for email recipients.

Use story

As a Mautic user
I want field labels to be included when I insert tokens into the message of the "Send form results" action
So that the form values in the resulting email are clear and meaningful

Before After
Screenshot 2025-05-13 at 10 29 11 AM image

Changes,

  • Remove unused template: _form_submitaction_sendemail_widget.html.twig
    The template located at app/bundles/FormBundle/Resources/views/FormTheme/SubmitAction/_form_submitaction_sendemail_widget.html.twig is no longer used and can be safely removed. Cleaning up dead code to reduce maintenance overhead.
  • Updated JavaScript code and templates to reflect the new approach for inserting form tokens.

📋 Steps to test this PR:

  1. Open this PR on Gitpod or pull down for testing locally (see docs on testing PRs here)
  2. Create a form:
    • Go to the Forms section.
    • Add fields like First Name and Email.
  3. Add a form action:
    • Go to the Actions tab.
    • Add the "Send form results" action.
  4. Verify initial token behavior:
    • Scroll to the Message field in the form action.
    • Click tokens like First Name or Email.
    • Confirm they are added in the format:
      <label>: {formfield=field_alias}
      For example:
      First Name: {formfield=first_name}
  5. Test adding a new field dynamically:
    • Add a new field to the form, e.g., Last Name.
    • Reopen the "Send form results" action.
  6. Verify updated token insertion:
    • Scroll to the "Click to insert field" section.
    • Click on "Last Name".
    • Confirm the following is inserted at the cursor or end of the message field:
      <strong>Last Name</strong>: {formfield=last_name}

Copy link

codecov bot commented May 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 65.83%. Comparing base (11d7b2b) to head (87265e7).
Report is 5 commits behind head on 7.x.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##                7.x   #14998   +/-   ##
=========================================
  Coverage     65.83%   65.83%           
  Complexity    35031    35031           
=========================================
  Files          2303     2303           
  Lines        140838   140838           
=========================================
+ Hits          92716    92717    +1     
+ Misses        48122    48121    -1     

see 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@shinde-rahul shinde-rahul marked this pull request as ready for review May 13, 2025 11:07
@shinde-rahul shinde-rahul added ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging forms Anything related to forms javascript Pull requests that update Javascript code labels May 13, 2025
@shinde-rahul shinde-rahul moved this to 🧑🏻‍💻 Needs a code review in Open Source Fridays May 13, 2025
Copy link
Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

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

The code looks good. Can you please mention in the PR description why the codeception library needed an upgrade and why the app/bundles/FormBundle/Resources/views/FormTheme/SubmitAction/_form_submitaction_sendemail_widget.html.twig file was deleted?

Added note under JavaScript section about the removal of Mautic.insertTextInEditor. Developers should use Mautic.insertHtmlInEditor instead.
@shinde-rahul
Copy link
Contributor Author

@escopecz, The composer file reverted to its previous state. I ran composer require --dev codeception/module-asserts when Codeception failed and the editor did not provide assertion autocomplete.

@shinde-rahul shinde-rahul requested a review from escopecz May 14, 2025 01:03
Copy link
Member

@escopecz escopecz left a comment

Choose a reason for hiding this comment

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

The code looks good, the enhancement works as described:

Screen.Recording.2025-05-14.at.09.33.19.mov

@escopecz escopecz added enhancement Any improvement to an existing feature or functionality code-review-passed PRs which have passed code review user-testing-passed PRs which have been successfully tested by the required number of people. and removed ready-to-test PR's that are ready to test code-review-needed PR's that require a code review before merging labels May 14, 2025
@escopecz escopecz added this to the 7.0.0-alpha milestone May 14, 2025
@escopecz escopecz merged commit bd6dac9 into mautic:7.x May 14, 2025
30 checks passed
@github-project-automation github-project-automation bot moved this from 🧑🏻‍💻 Needs a code review to 🥳 Done in Open Source Fridays May 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code-review-passed PRs which have passed code review enhancement Any improvement to an existing feature or functionality forms Anything related to forms javascript Pull requests that update Javascript code user-testing-passed PRs which have been successfully tested by the required number of people.
Projects
Status: 🥳 Done
Development

Successfully merging this pull request may close these issues.

2 participants