-
Notifications
You must be signed in to change notification settings - Fork 846
Enable Jetpack Forms package by default #28791
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
Conversation
|
Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run to get started. More details: p9dueE-5Nn-p2 |
|
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 🤖 The e2e test report can be found here. Please note that it can take a few minutes after the e2e tests checks are complete for the report to be available. Once your PR is ready for review, check one last time that all required checks (other than "Required review") appearing at the bottom of this PR are passing or skipped. Jetpack plugin:
|
jcheringer
left a comment
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.
Added a small comment regarding the flag we use to control the registration of the blocks in the editor.
| * @param bool $load_contact_form_package Load Jetpack Forms package. Default to false. | ||
| */ | ||
| if ( apply_filters( 'jetpack_contact_form_use_package', false ) ) { | ||
| if ( apply_filters( 'jetpack_contact_form_use_package', true ) ) { |
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.
Not sure if there's a way we can make the filter always return true by default, otherwise we'll also need to change the default value here: https://github.com/Automattic/jetpack/blob/trunk/projects/plugins/jetpack/class.jetpack-gutenberg.php#L695
The line above allows us to control whether we want to register the blocks from the jetpack plugin or the blocks from the Forms package.
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.
Might turn into a race condition. I think we should add somewhere at the top add_filter( 'jetpack_contact_form_use_package', '__return_true' );, but it would also be legal to get that line inside this if, so, if nobody has a saying on it, we'll enable it for all subsequent calls:
if ( apply_filters( 'jetpack_contact_form_use_package', true ) ) {
Jetpack_Forms::load_contact_form();
add_filter( 'jetpack_contact_form_use_package', '__return_true' );
return true;
}
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.
Not sure I understand what you mean 🤔 Wouldn't simply changing the other line you linked to to true as well so it's consistent fix the issue?
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.
What I'm saying is: there's no function handling the filter, we just trust the default value we assign during the apply_filters call. So, who/where is it decided that this filter returns true|false?
So, yes, @jcheringer solution is valid, but both calls to apply_filters rely on the default value, hence my question: where is this actually decided? And if the answer is "still nowhere", then make it a single point of entry and once the first apply_filters is run, add a listener/handler for any other subsequent calls. Next time, instead of having to change this in two places, you'd only do it on a single change.
It might also be the case that the two calls to apply_filters are completely independent and need to remain that way, then it makes sense to call it twice and provide a true by default.
jcheringer
left a comment
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.
LGTM!
jeherve
left a comment
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.
Before we flip the switch, I wonder if we should plan some kind of wider testing, at 2 levels:
- At the release level, to ensure that the package and its assets are correctly enqueued / shipped from their new location.
- At the WordPress.com Simple and WoA levels. They'll be the first ones to get the update, as early as next week if we merge this in the next few days. Maybe there could be a call for testing before that happens, to ensure we're not breaking anything?
What do you think?
CGastrell
left a comment
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.
It does what it says
|
Following a the call for testing (pcsBup-V4-p2), we've been running from the package on WP.com since March and I believe all remaining glitches that we were aware of have now been fixed. So I think we can merge this now :) |
Proposed changes:
Once #28752 is merged, we'll have migrated all contact form related code to the new automattic/jetpack-forms package. In order to not have to maintain multiple codebases, we'd like to make the package the new default with the existing module becoming deprecated and eventually removed - possibly in the following jetpack version once we've confirmed everything is running smoothly.
Other information:
Jetpack product discussion
pcsBup-N3-p2
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
This PR doesn't contain any user facing changes, that's said it's good to check some of the following:
Feedback.