-
Notifications
You must be signed in to change notification settings - Fork 804
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
Custom Content Types: Ensure settings page functionality works without module requirement #41349
base: trunk
Are you sure you want to change the base?
Custom Content Types: Ensure settings page functionality works without module requirement #41349
Conversation
…k without the module file
…ency with other initial states within Jetpack.
…s from the eslint excludelist as it is now free of issues
…des words from the Custom Content Types description.
…prevent test failures, and checking CPTs exist via window variable to determine Writing navigation tab display.
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 🤖 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. Follow this PR Review Process:
Still unsure? 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. |
… clarify it's addition
…t failures. Plus some cleanup.
Code Coverage SummaryCoverage changed in 10 files. Only the first 5 are listed here.
3 files are newly covered.
|
@@ -34,18 +35,74 @@ function jetpack_load_custom_post_types() { | |||
add_action( 'jetpack_activate_module_custom-content-types', array( '\Automattic\Jetpack\Classic_Theme_Helper\Jetpack_Testimonial', 'activation_post_type_support' ) ); | |||
|
|||
add_action( 'init', array( '\Automattic\Jetpack\Classic_Theme_Helper\Nova_Restaurant', 'init' ) ); | |||
|
|||
$site_id = Connection_Manager::get_site_id(); | |||
if ( is_wp_error( $site_id ) ) { |
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.
Adding the site id check here prevents issues with multiple APIs, or rather failing tests. See the link in this Slack thread for more on those failing tests: p1738057987804199/1738056861.398469-slack-CDLH4C1UZ
I'd like to hear more though from anyone who has more knowledge of the interconnectedness of the REST APIs as well as the api-v2 tests as to how these may have been overlapping, if possible.
if ( class_exists( 'Jetpack' ) ) { | ||
Jetpack::enable_module_configurable( __FILE__ ); | ||
} | ||
$initial_state = 'var CUSTOM_CONTENT_TYPE__INITIAL_STATE; typeof CUSTOM_CONTENT_TYPE__INITIAL_STATE === "object" || (CUSTOM_CONTENT_TYPE__INITIAL_STATE = JSON.parse(decodeURIComponent("' . rawurlencode( |
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 variable follows the same style as a couple of other initial states, such as JP_CONNECTION_INITIAL_STATE
:
return 'var JP_CONNECTION_INITIAL_STATE; typeof JP_CONNECTION_INITIAL_STATE === "object" || (JP_CONNECTION_INITIAL_STATE = JSON.parse(decodeURIComponent("' . rawurlencode( wp_json_encode( self::get_data() ) ) . '")));'; |
@@ -277,6 +277,11 @@ function JetpackRestApiClient( root, nonce ) { | |||
.then( checkStatus ) | |||
.then( parseJsonResponse ), | |||
|
|||
getFeatureTypeStatus: customContentType => |
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.
The intention behind having this as part of the Jetpack HTTP API is because it ideally will be able to be used by multiple removed 'features' depending on their location.
Fixes https://github.com/Automattic/vulcan/issues/508
Proposed changes:
This PR ensures the Custom Content Types card with Jetpack Portfolio and Testimonials toggles and links on the Jetpack > Settings > Writing page can continue to function when there is no Custom Content Types module file in Jetpack. This is because this file will be removed as part of the cleanup once the Classic Theme Helper plugin is live and the features loaded via the Classic Theme Helper package directly.
Changes include:
rest_api_init
hook./wp-admin/admin.php?page=jetpack_modules
- rather than trying to create a workaround. It also it wasn't working prior to this PR.Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions:
Other tests:
http://localhost/wp-admin/admin.php?page=jetpack_modules
, make sure you can't see Custom Content Types (this also didn't work previously so it's removal should have no consequence)This functionality should continue to work both with and without the Custom Content Types module file in place. However if you want to test that removing the module file also does not break any functionality, then delete the
jetpack/modules/custom-content-types.php
file and follow the same testing steps as above.Previous quirks that have been fixed in this PR