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
Merged
Show file tree
Hide file tree
Changes from 11 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
77c6df9
Removing contact form module files
coder-karen May 1, 2024
588cd5e
Remove references in webpack.config.css.js and exclude lists
coder-karen May 1, 2024
bc1be50
Remove or change references to contact form classes and files
coder-karen May 1, 2024
5aa778c
Updating test references - removing test file
coder-karen May 1, 2024
349f477
Removing is_form_package_enabled from enqueue_block_editor_assets as …
coder-karen May 1, 2024
7277c52
Deleting the duplicated Google Drive helper class
coder-karen May 1, 2024
3db1ec3
changelog
coder-karen May 1, 2024
700f245
mce_external_plugins file path update, and phan file reference removal
coder-karen May 1, 2024
08b1d4c
Updating webpack.config.css.js to re-add contact form files but with …
coder-karen May 1, 2024
5fdb20a
Update projects/plugins/crm/changelog/remove-contact-form-module-code
coder-karen May 1, 2024
45a5fd7
Updating package versions, and removing unnecessary phan line
coder-karen May 1, 2024
ded8b13
Adding back google drive helper file and adding deprecation notices
coder-karen May 2, 2024
db376c1
Deprecating a filter and removing unneeded code
coder-karen May 2, 2024
36af504
Ensuring jetpack/tools/webpack.config.css.js doesn't generate rtl fil…
coder-karen May 2, 2024
3ec6595
Modifying JS file references to take them from the dist folder instead
coder-karen May 2, 2024
56f3f0d
Merge branch 'trunk' into remove/contact-form-module-code
coder-karen May 2, 2024
1e82c72
Updates (composer.lock, phan baseline formatting) to fix failing checks
coder-karen May 2, 2024
b7dbde1
Manually adding Jetpack plugin version to deprecated_hooks filter add…
coder-karen May 2, 2024
5028f70
Adding in deprecations for the jetpack_form_register_pattern function
coder-karen May 2, 2024
c354ed7
Adding a line to the phan baseline because of a newly added deprecati…
coder-karen May 2, 2024
cf85f00
Converting tabs to spaces on one line
coder-karen May 2, 2024
387bd8f
Modify tinyme editor file path to prevent issues loading shortcode ba…
coder-karen May 6, 2024
a2b125a
Merge remote-tracking branch 'origin/trunk' into remove/contact-form-…
coder-karen May 6, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: removed

Contact Form: Removing code and renaming relevant references to ensure we use the package version of the contact form.
2 changes: 1 addition & 1 deletion projects/packages/forms/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@
"link-template": "https://github.com/automattic/jetpack-forms/compare/v${old}...v${new}"
},
"branch-alias": {
"dev-trunk": "0.30.x-dev"
"dev-trunk": "0.31.x-dev"
},
"textdomain": "jetpack-forms",
"version-constants": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/forms/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"private": true,
"name": "@automattic/jetpack-forms",
"version": "0.30.19-alpha",
"version": "0.31.0-alpha",
"description": "Jetpack Forms",
"homepage": "https://github.com/Automattic/jetpack/tree/HEAD/projects/packages/forms/#readme",
"bugs": {
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/forms/src/class-jetpack-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/
class Jetpack_Forms {

const PACKAGE_VERSION = '0.30.19-alpha';
const PACKAGE_VERSION = '0.31.0-alpha';

/**
* Load the contact form module.
Expand Down
2 changes: 1 addition & 1 deletion projects/packages/forms/src/contact-form/class-admin.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ public function print_export_modal() {
* Ajax handler for wp_ajax_grunion_export_to_gdrive.
* Exports data to Google Drive, based on POST data.
*
* @see Grunion_Contact_Form_Plugin::get_feedback_entries_from_post
* @see Contact_Form_Plugin::get_feedback_entries_from_post
*/
public function export_to_gdrive() {
$post_data = wp_unslash( $_POST );
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public static function grunion_media_button() {
public static function mce_external_plugins( $plugin_array ) {
$plugin_array['grunion_form'] = Assets::get_file_url_for_environment(
'_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!

);
return $plugin_array;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: removed

Contact Form: Updated a comment reference to Grunion_Contact_Form_Plugin to be Contact_Form_Plugin.
2 changes: 1 addition & 1 deletion projects/plugins/crm/includes/ZeroBSCRM.Jetpack.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
* Creates a ZBS contact from a Jetpack form submission.
*
* @param integer $post_id The post id that contains the contact form data.
* @param array $all_field_data An array containg the form's Grunion_Contact_Form_Field objects.
* @param array $all_field_data An array containg the form's Contact_Form_Field objects.
* @param bool $is_spam Whether the form submission has been identified as spam.
* @param array $entry_values The feedback entry values.
*/
Expand Down
3 changes: 0 additions & 3 deletions projects/plugins/jetpack/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@
'_inc/lib/admin-pages/class.jetpack-admin-page.php' => ['PhanDeprecatedProperty', 'PhanTypeMismatchArgumentProbablyReal', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'],
'_inc/lib/class-jetpack-ai-helper.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchPropertyDefault'],
'_inc/lib/class-jetpack-currencies.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal'],
'_inc/lib/class-jetpack-google-drive-helper.php' => ['PhanTypeMismatchReturnProbablyReal'],
'_inc/lib/class-jetpack-instagram-gallery-helper.php' => ['PhanTypeMismatchArgument'],
'_inc/lib/class-jetpack-mapbox-helper.php' => ['PhanTypeMismatchArgumentNullable'],
'_inc/lib/class-jetpack-podcast-feed-locator.php' => ['PhanDeprecatedFunctionInternal'],
Expand Down Expand Up @@ -354,7 +353,6 @@
'modules/comments/base.php' => ['PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredProperty'],
'modules/comments/comments.php' => ['PhanPluginDuplicateConditionalNullCoalescing', 'PhanRedundantCondition', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeMismatchArgument', 'PhanUndeclaredFunction'],
'modules/comments/subscription-modal-on-comment/class-jetpack-subscription-modal-on-comment.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchReturnNullable'],
'modules/contact-form/grunion-contact-form.php' => ['PhanDeprecatedClass', 'PhanDeprecatedFunction', 'PhanDeprecatedProperty', 'PhanTypeMismatchArgument', 'PhanTypeMismatchProperty', 'PhanTypeMismatchReturnProbablyReal', 'PhanUndeclaredClassMethod', 'PhanUndeclaredStaticProperty', 'PhanUnextractableAnnotationElementName'],
'modules/copy-post.php' => ['PhanNoopNew'],
'modules/custom-css/csstidy/class.csstidy-ctype.php' => ['PhanRedefineFunctionInternal'],
'modules/custom-css/csstidy/class.csstidy-optimise.php' => ['PhanPluginDuplicateExpressionAssignmentOperation', 'PhanPluginSimplifyExpressionBool', 'PhanTypeComparisonFromArray', 'PhanTypeConversionFromArray', 'PhanTypeExpectedObjectPropAccess', 'PhanTypeInvalidRightOperandOfNumericOp', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentInternal', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchReturnProbablyReal'],
Expand Down Expand Up @@ -597,7 +595,6 @@
'tests/php/json-api/test_class.json-api-platform-jetpack.php' => ['PhanTypeMismatchArgument'],
'tests/php/media/test-class.jetpack-media-extractor.php' => ['PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentProbablyReal'],
'tests/php/media/test-class.jetpack-post-images.php' => ['PhanTypeMismatchArgumentProbablyReal'],
'tests/php/modules/contact-form/test-class.grunion-contact-form.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgument', 'PhanTypeMismatchArgumentNullableInternal', 'PhanTypeMismatchReturnSuperType', 'PhanUndeclaredMethod'],
'tests/php/modules/geo-location/test_class.jetpack-geo-location.php' => ['PhanDeprecatedFunction', 'PhanTypeMismatchArgumentProbablyReal'],
'tests/php/modules/google-analytics/test-class.google-analytics.php' => ['PhanDeprecatedFunction'],
'tests/php/modules/google-analytics/test-class.jetpack-google-amp-analytics.php' => ['PhanTypeMismatchArgument', 'PhanUndeclaredMethod'],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public static function initialize() {
* Process Salesforce Lead forms
*
* @param int $post_id - the post_id for the CPT that is created.
* @param array $fields - Grunion_Contact_Form_Field array.
* @param array $fields - Contact_Form_Field array.
* @param bool $is_spam - marked as spam by Akismet(?).
* @param array $entry_values - extra fields added to from the contact form.
*
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: minor
Type: other

Contact Form: Removing code and renaming relevant references to ensure we use the package version of the contact form.
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: other
Comment: Updated composer.lock.


5 changes: 0 additions & 5 deletions projects/plugins/jetpack/class.jetpack-gutenberg.php
Original file line number Diff line number Diff line change
Expand Up @@ -725,11 +725,6 @@ public static function enqueue_block_editor_assets() {
* @param bool true Enable the RePublicize UI in the block editor context. Defaults to true.
*/
'republicize_enabled' => apply_filters( 'jetpack_block_editor_republicize_feature', true ),
/**
* 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.

),
'siteFragment' => $status->get_site_suffix(),
'adminUrl' => esc_url( admin_url() ),
Expand Down
4 changes: 2 additions & 2 deletions projects/plugins/jetpack/composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 0 additions & 18 deletions projects/plugins/jetpack/modules/contact-form.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}

require_once __DIR__ . '/contact-form/grunion-contact-form.php';

/*
* Filters if the new Contact Form Editor View should be used.
*
* A temporary filter to disable the new Editor View for the older UI.
* Please note this filter and the old UI will be removed in the future.
* Expected to be removed in Jetpack 5.8 or if a security issue merits removing the old code sooner.
*
* @since 5.2.0
* @deprecated 13.2.0
*
* @param boolean $view Use new Editor View. Default true.
*/
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! 👍

*/
Expand Down
Loading
Loading