Skip to content
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

Contact Form: Removing code and renaming relevant references to ensure we use the package version #37157

Merged
merged 23 commits into from
May 6, 2024

Conversation

coder-karen
Copy link
Contributor

@coder-karen coder-karen commented May 1, 2024

Fixes step 2 of this project: pf5801-Aj-p2

Proposed changes:

  • This PR addresses step 2 of this project: pf5801-Aj-p2. Specifically, it focusses on the following:
    • Deleting module/contact-form files.
    • Updating any references to deleted files, classes or functions to use the package version

Note - before merging, this diff needs to be deployed first: D147229-code

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

pf5801-Aj-p2

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

No.

Testing instructions:

  • To test, apply this PR and make sure to test the contact form (block, also using the Classic Editor) on a test site and ensure that it continues to work as expected.
  • Ensure no errors are being reported in logs.

@coder-karen coder-karen self-assigned this May 1, 2024
@github-actions github-actions bot added [Feature] Contact Form [Focus] Compatibility Ensuring our products play well with third-parties [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests labels May 1, 2024
Copy link
Contributor

github-actions bot commented May 1, 2024

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 WordPress.com Simple 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, and enable the remove/contact-form-module-code branch.

  • To test on Simple, run the following command on your sandbox:

    bin/jetpack-downloader test jetpack remove/contact-form-module-code
    

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

Copy link
Contributor

github-actions bot commented May 1, 2024

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 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 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 reviewed, it can then be merged.
If you need an extra review from someone familiar with the codebase, you can update the labels from "[Status] Needs Team Review" to "[Status] Needs Review", and in that case Jetpack Approvers will do a final review of your PR.


Jetpack plugin:

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

  • WordPress.com Simple releases happen daily.
  • WoA releases happen weekly.
  • Releases to self-hosted sites happen monthly. The next release is scheduled for June 4, 2024 (scheduled code freeze on May 27, 2024).

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

@coder-karen coder-karen marked this pull request as ready for review May 1, 2024 16:07
@coder-karen coder-karen added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] In Progress labels May 1, 2024
@coder-karen coder-karen requested a review from a team May 1, 2024 16:14
@@ -1,126 +0,0 @@
<?php
Copy link
Member

Choose a reason for hiding this comment

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

Since the class or the file were not marked as deprecated before, I would recommend keeping that file around for a couple more releases, but mark them as deprecated so they throw a notice instead of a fatal for anyone that may still rely on them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks for pointing that out. Added back and marking as deprecated now in ded8b13

* Prevent the registration of the blocks from extensions/blocks/contact-form
* if the Forms package is enabled.
*/
'is_form_package_enabled' => apply_filters( 'jetpack_contact_form_use_package', true ),
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to add that deprecated hook to the deprecated_hooks method in the Jetpack class.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah good to know.

@@ -35,24 +35,6 @@
return true; // Not returning true will cause the module to become deactivated.
Copy link
Member

Choose a reason for hiding this comment

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

Should we remove the check provided by the filter above now and deprecate the filter, since there is no other way to use the contact form anymore?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did wonder, especially with the comment after return true. But everything works well in testing so this looks like it should be ok to deprecate. I'll add an update to the WPcom diff as well as there is one more filter mention there.

if ( is_admin() && apply_filters_deprecated( 'tmp_grunion_allow_editor_view', array( true ), '13.2.0', '', 'This functionality will be removed in an upcoming version.' ) ) {
require_once __DIR__ . '/contact-form/grunion-editor-view.php';
}

/**
* Register Jetpack Form patterns
Copy link
Member

Choose a reason for hiding this comment

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

I think we should be able to remove this as well, since it is provided in the package too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Gotcha.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Actually to double check, what code are you referring to removing?

Copy link
Member

Choose a reason for hiding this comment

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

The code that registers the patterns, jetpack_form_register_pattern. It's also in Utils::register_pattern()

Copy link
Contributor Author

@coder-karen coder-karen May 2, 2024

Choose a reason for hiding this comment

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

Ah right, I was busy searching for the function name instead. So since it lives elsewhere now with a different function name, presumably I'd still need to deprecate this specific function initially first before deleting it, similarly to the Google Drive Helper functions? I've assumed so initially with a new commit.

Copy link
Member

Choose a reason for hiding this comment

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

Yes, I think that's the right thing to do! 👍

'modules/contact-form/css/editor-inline-editing-style',
'modules/contact-form/css/editor-style',
'modules/contact-form/css/editor-ui',
'jetpack_vendor/automattic/jetpack-forms/src/contact-form/css/editor-inline-editing-style',
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't we remove those altogether, since they are built in the package via the projects/packages/forms/tools/webpack.config.contact-form.js config?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes definitely :) I just realized the issue now on rebuilding locally, and spotting some untracked rtl CSS files being generated.

Comment on lines 63 to 64
'_inc/build/contact-form/js/tinymce-plugin-form-button.min.js',
'modules/contact-form/js/tinymce-plugin-form-button.js'
'jetpack_vendor/automattic/jetpack-forms/src/contact-form/js/tinymce-plugin-form-button.js'
Copy link
Member

Choose a reason for hiding this comment

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

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Certainly!

@jeherve jeherve added [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! and removed [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. labels May 2, 2024
@coder-karen coder-karen added [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. and removed [Status] Needs Author Reply We would need you to make some changes or provide some more details about your PR. Thank you! labels May 2, 2024
@monsieur-z
Copy link
Contributor

monsieur-z commented May 3, 2024

It works seamlessly with the Gutenberg editor. However, some paths seem to be broken when using the classic editor.
Screenshot 2024-05-03 at 1 56 46 PM

@coder-karen
Copy link
Contributor Author

It works seamlessly with the Gutenberg editor. However, some paths seem to be broken when using the classic editor.

Great catch, thanks. This will be fixed now in 387bd8f

@coder-karen coder-karen requested a review from a team May 6, 2024 11:49
Copy link
Contributor

@monsieur-z monsieur-z left a comment

Choose a reason for hiding this comment

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

LGTM!

@coder-karen coder-karen merged commit 9bf534c into trunk May 6, 2024
56 checks passed
@coder-karen coder-karen deleted the remove/contact-form-module-code branch May 6, 2024 16:17
@github-actions github-actions bot removed the [Status] Needs Review To request a review from fellow Jetpack developers. Label will be renamed soon. label May 6, 2024
pkuliga pushed a commit that referenced this pull request May 9, 2024
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 [Focus] Compatibility Ensuring our products play well with third-parties [Package] Forms [Plugin] CRM Issues about the Jetpack CRM plugin [Plugin] Jetpack Issues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/ [Tests] Includes Tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants