-
Notifications
You must be signed in to change notification settings - Fork 800
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
Publicize: Adjust how the Connections Post Field is initialised #40613
base: trunk
Are you sure you want to change the base?
Conversation
In order to make it compatible with use on WPCOM we need to adjust how the Connections Post Field is initialised. This adds a constructor to handle registering the `rest_init` hook, and adds the WPCOM specific logic.
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! |
// Adding on a higher priority to make sure we're the first field registered. | ||
// The priority parameter can be removed once we deprecate WPCOM_REST_API_V2_Post_Publicize_Connections_Field | ||
add_action( 'rest_api_init', array( new Connections_Post_Field(), 'register_fields' ), 5 ); | ||
new Connections_Post_Field(); |
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.
Will this be initialized on Simple sites?
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.
I don't think the on_jetpack_feature_publicize_enabled
method here is called on WPCOM. We need an unconditional initialization for WPCOM, the way we do for assets.
Probably, we should have a method named unconditional_initialization
inside Publicize_Setup
class to add all that logic there and also more that assets initialization logic into that.
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.
Yes we would need to adjust the loading of it on WPCOM too
We can now revisit this? |
In order to make it compatible with use on WPCOM we need to adjust how the Connections Post Field is initialised. This adds a constructor to handle registering the
rest_init
hook, and adds the WPCOM specific logic.Fixes Automattic/jetpack-reach#720
Other information:
Does this pull request change what data or activity we track or use?
No.
Testing instructions:
We need to check that the behaviour is the same as it is currently.