Skip to content

Conversation

@ice9js
Copy link
Contributor

@ice9js ice9js commented Feb 6, 2023

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:

  • 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

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:

  • Contact form blocks should still load as expected in the editor.
  • Submitting feedback or contact form responses should still work correctly.
  • You should be able to access the submitted responses in WP Admin under Feedback.

@ice9js ice9js added the [Status] Needs Team Review Obsolete. Use Needs Review instead. label Feb 6, 2023
@ice9js ice9js self-assigned this Feb 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2023

Are you an Automattician? You can now test your Pull Request on WordPress.com. On your sandbox, run

bin/jetpack-downloader test jetpack update/enable-jetpack-forms-package

to get started. More details: p9dueE-5Nn-p2

@github-actions github-actions bot added the [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ label Feb 6, 2023
@github-actions
Copy link
Contributor

github-actions bot commented Feb 6, 2023

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.
  • ✅ All commits were linted before commit.
  • ✅ Add a "[Status]" label (In Progress, Needs Team Review, ...).
  • ✅ 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 🤖


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.
Then, add the "[Status] Needs Team review" label and ask someone from your team review the code.
Once you’ve done so, switch to the "[Status] Needs Review" label; someone from Jetpack Crew will then review this PR and merge it to be included in the next Jetpack release.


Jetpack plugin:

  • Next scheduled release: June 6, 2023.
  • Scheduled code freeze: May 29, 2023.

Copy link
Contributor

@jcheringer jcheringer left a 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 ) ) {
Copy link
Contributor

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.

Copy link
Contributor

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;
}

Copy link
Contributor Author

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?

Copy link
Contributor

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.

Copy link
Contributor

@jcheringer jcheringer left a comment

Choose a reason for hiding this comment

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

LGTM!

@jcheringer jcheringer added [Status] Needs Review This PR is ready for review. and removed [Status] Needs Team Review Obsolete. Use Needs Review instead. labels Feb 8, 2023
Copy link
Member

@jeherve jeherve left a 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?

@jeherve jeherve added [Feature] Contact Form [Block] Contact Form Form block (also see Contact Form label) [Package] Forms [Type] Janitorial [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. and removed [Status] Needs Review This PR is ready for review. labels Feb 10, 2023
@ice9js ice9js mentioned this pull request Mar 2, 2023
3 tasks
Copy link
Contributor

@CGastrell CGastrell left a 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

@ice9js ice9js added DO NOT MERGE don't merge it! and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. labels Mar 7, 2023
@github-actions github-actions bot added the [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. label Mar 7, 2023
@ice9js
Copy link
Contributor Author

ice9js commented May 4, 2023

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 :)

@ice9js ice9js added [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Review This PR is ready for review. and removed [Status] Needs Author Reply We need more details from you. This label will be auto-added until the PR meets all requirements. DO NOT MERGE don't merge it! [Status] Ready to Merge Go ahead, you can push that green button! labels May 4, 2023
@jeherve jeherve added [Status] Ready to Merge Go ahead, you can push that green button! [Status] Needs Testing We need to add this change to the testing call for this month's release and removed [Status] Needs Review This PR is ready for review. labels May 8, 2023
@ice9js ice9js enabled auto-merge (squash) May 8, 2023 07:59
@ice9js ice9js merged commit 0173104 into trunk May 8, 2023
@ice9js ice9js deleted the update/enable-jetpack-forms-package branch May 8, 2023 08:17
@github-actions github-actions bot removed the [Status] Ready to Merge Go ahead, you can push that green button! label May 8, 2023
@anomiex anomiex removed the [Status] Needs Testing We need to add this change to the testing call for this month's release label May 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Block] Contact Form Form block (also see Contact Form label) [Feature] Contact Form [Package] Forms [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Type] Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants