-
Notifications
You must be signed in to change notification settings - Fork 841
Forms: handle first/last names in feedback classes #45944
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Are you an Automattician? Please test your changes on all WordPress.com environments to help mitigate accidental explosions.
Interested in more tips and information?
|
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
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:
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:
If you have any questions about the release process, please ask in the #jetpack-releases channel on Slack. |
Code Coverage SummaryCoverage changed in 2 files.
|
| ) | ||
| ); | ||
| } | ||
| // This name value is filtered upstream when class is instantiated. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Feedback_Author->get_name() will now return 'First Last' if available, or fallback to 'Single Name' as before.
I added the filter here to ensure equivalence. We filter the single 'name' field in both places before we instantiate the Feedback_Author class class.
| */ | ||
| public function get_author_last_name() { | ||
| return $this->author_data->get_last_name(); | ||
| } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR does not use the two getters above, but I wanted to provide these for future handling, and we'll likely update our integration logic for MailPoet and Hostinger to leverage these methods.
| 'title' => 'Test Form', | ||
| 'description' => 'This is a test form.', | ||
| ), | ||
| "[contact-field label='Message' type='textarea' required='1'/]" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should never work. Since the first and and last name fields are not specified in the form.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since the form validation would prevent this from happening.
Fixes FORMS-393
Proposed changes:
We added first and last variations for name. But we do not handle those properly post-submission. For example, before this PR, existing code would grab the first 'name' field of any kind and use that as the author name for a form response. So that means it would find first or last, and use that alone.
This PR adds proper handling of first and last names to the Feedback and Feedback_Author classes. Changes include:
Caveats: There maybe languages/locales where names are reversed. We can figure out if/how to handle that separately.
Before

After

Other information:
Jetpack product discussion
See linear issue.
Does this pull request change what data or activity we track or use?
No.
Testing instructions: