Skip to content

Conversation

@enejb
Copy link
Member

@enejb enejb commented Oct 27, 2025

Part of FORMS-316

This PR adds the emoji flag next the IP Address.

Screenshot 2025-10-27 at 3 04 05 PM

Proposed changes:

  • Adds a new method to the get_country_flag() class to the Feedback class.
  • Apply the new method to the email copy next to the IP.

Other information:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

N/A

Does this pull request change what data or activity we track or use?

No

Testing instructions:

  • Apply this class.
  • Fill out the form from a non Private IP Address. (try testing it via a jurassic ninja site )
  • Check the email that you recieved. Notice the emoji flag.

Do the tests pass?

@enejb enejb requested review from a team and Copilot October 27, 2025 22:02
@enejb enejb added [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it [Status] Needs Review This PR is ready for review. [Package] Forms labels Oct 27, 2025
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds country flag emoji indicators to form submission notification emails by implementing a method to convert country codes to their corresponding emoji flags and displaying them next to the IP address.

  • Implements get_country_flag() and country_code_to_emoji_flag() methods in the Feedback class
  • Updates email template to include flag emoji after IP address
  • Adds comprehensive test coverage for various country codes

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
projects/plugins/jetpack/changelog/add-emoji-flag-to-email-responses Changelog entry documenting the enhancement
projects/packages/forms/tests/php/contact-form/Feedback_Test.php Test cases for country flag conversion with multiple country codes
projects/packages/forms/src/contact-form/class-feedback.php Core implementation of country code to emoji flag conversion
projects/packages/forms/src/contact-form/class-contact-form.php Email template update to display flag emoji next to IP address
projects/packages/forms/changelog/add-emoji-flag-to-email-responses Package-specific changelog entry

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.

  • To test on WoA, go to the Plugins menu on a WoA dev site. Click on the "Upload" button and follow the upgrade flow to be able to upload, install, and activate the Jetpack Beta plugin. Once the plugin is active, go to Jetpack > Jetpack Beta, select your plugin (Jetpack), and enable the add/emoji-flag-to-email-responses branch.
  • To test on Simple, run the following command on your sandbox:
bin/jetpack-downloader test jetpack add/emoji-flag-to-email-responses

Interested in more tips and information?

  • In your local development environment, use the jetpack rsync command to sync your changes to a WoA dev blog.
  • Read more about our development workflow here: PCYsg-eg0-p2
  • Figure out when your changes will be shipped to customers here: PCYsg-eg5-p2

@github-actions github-actions bot added [Feature] Contact Form [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels Oct 27, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Oct 27, 2025

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖


Follow this PR Review Process:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!


Jetpack plugin:

The Jetpack plugin has different release cadences depending on the platform:

  • WordPress.com Simple releases happen as soon as you deploy your changes after merging this PR (PCYsg-Jjm-p2).
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly:
    • Scheduled release: November 4, 2025
    • Code freeze: November 3, 2025

If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack.

@jp-launch-control
Copy link

jp-launch-control bot commented Oct 27, 2025

Code Coverage Summary

Coverage changed in 2 files.

File Coverage Δ% Δ Uncovered
projects/packages/forms/src/contact-form/class-feedback.php 639/671 (95.23%) -0.07% 1 ❤️‍🩹
projects/packages/forms/src/contact-form/class-contact-form.php 643/1182 (54.40%) 0.04% 0 💚

Full summary · PHP report · JS report

enejb added 2 commits October 27, 2025 17:33
Introduces a method to convert country codes to emoji flags in the Feedback class and displays the flag alongside the IP address in the contact form footer. Includes unit tests to verify correct flag generation for various country codes and handles cases where the country code is unavailable.
@enejb enejb force-pushed the add/emoji-flag-to-email-responses branch from aaf7991 to 0986d98 Compare October 28, 2025 00:33
/* translators: Placeholder is the IP address of the person who submitted a form. */
esc_html__( 'IP Address: %1$s', 'jetpack-forms' ),
$comment_author_ip
/* translators: %1$s placeholder is the IP address, %2$s is the country flag of the person who submitted a form. */
Copy link
Member

Choose a reason for hiding this comment

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

Seems a bit complicated to have separate placeholder for countryflag, instead of just using one placeholder for both — I don't really see translators needing to swap their placess after all

Copy link
Member

Choose a reason for hiding this comment

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

Actually, another consideration is that we'll want to link the IP but not the flag, so they'll need to be separately eventually. 🙃 That wouldn't necessarily affect IP Address: %s string tho.

Copy link
Member Author

Choose a reason for hiding this comment

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

Sounds good. I was thinking about this as well. I though that in some languages they would want to have a space in there and it some cases this would not be ideal.

But lets preserve the current translation for this for now and if we get feedback that this doesn't work we can revisit this. ( I will revert to the previous translation )

"[contact-field label='Name' type='name' required='1'/][contact-field label='Email' type='email' required='1'/][contact-field label='Message' type='textarea' required='1'/]"
);

// Test valid country codes
Copy link
Member

Choose a reason for hiding this comment

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

Do you know that all our country codes (including the ones for small countries) map 1:1 to Unicode?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good question. I think so see https://en.wikipedia.org/wiki/Regional_indicator_symbol

I haven't tested this explicitly but that is what I understand. They had to make this mapping somehow ( assigning a unicode to a string ) it would make sense if they followed some sort of convention.


return $flag;
}

Copy link
Contributor

Choose a reason for hiding this comment

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

I did not know the country code emoji's worked like this. :)

edanzer
edanzer previously approved these changes Oct 29, 2025
Copy link
Contributor

@edanzer edanzer left a comment

Choose a reason for hiding this comment

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

This tests as expected. I see country code in email like below. Also tests pass. I learned something very new about how country flag emoji's work too. I'm surprised at the relative simplicity of the code changes to get this working.

test country flag in email

@enejb enejb merged commit bdde1c4 into trunk Oct 30, 2025
67 checks passed
@enejb enejb deleted the add/emoji-flag-to-email-responses branch October 30, 2025 01:21
@github-actions github-actions bot added this to the jetpack/15.2 milestone Oct 30, 2025
@github-actions github-actions bot removed the [Status] Needs Review This PR is ready for review. label Oct 30, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests [Type] Enhancement Changes to an existing feature — removing, adding, or changing parts of it

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants