-
Notifications
You must be signed in to change notification settings - Fork 815
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
Sync: Don't clear $this->just_published completely #6542
Conversation
Some plugins could have a wp_insert_post hooked into the save_post action. In that case we were clearing $this->just_published without waiting for the original post from being inserted.
It appears there were a few build variations that failed, though it's unclear why they would and I'm unable to retrieve the logs. Perhaps just needs a build restart? |
I'm not as familiar with when I've also run these changes in the context of my Jetpack site configured to Publicize through my sandbox and confirmed in the before/after case of the changes applied that both posts with and without a recipe Publicized successfully. 👍 |
support WP core < 4.7
…should_email_post_to_subscribers
* @param int post_id | ||
* @param mixed array post flags that are added to the post | ||
*/ | ||
|
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.
Looks like you have an extra empty line that will trip the parser.
sync/class.jetpack-sync-sender.php
Outdated
@@ -77,6 +77,7 @@ private function continue_full_sync_enqueue() { | |||
} | |||
|
|||
public function do_sync() { | |||
do_action( 'jetpack_sync_before_do_sync' ); |
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.
Could you add a docblock here? Thanks!
always call `jetpack_sync_send_published` if the posts listener was listening :)
This reverts commit 109ec88.
add_action( 'deleted_post', $callable, 10 ); | ||
add_action( 'jetpack_publicize_post', $callable ); | ||
add_action( 'jetpack_published_post', $callable, 10, 2 ); | ||
add_action( 'transition_post_status', array( $this, 'save_published' ), 10, 3 ); | ||
add_filter( 'jetpack_sync_before_enqueue_wp_insert_post', array( $this, 'filter_blacklisted_post_types' ) ); | ||
|
||
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.
we need to remove this spaces, waiting for tests to pass first 😓
@@ -28,7 +28,7 @@ public function test_fires_jetpack_publicize_post_on_save_as_published() { | |||
$this->post->post_status = 'publish'; | |||
|
|||
wp_insert_post( $this->post->to_array() ); | |||
|
|||
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.
more spaces to clean
The previous solution doesn’t fix the issue for core < 4.7
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 feel confidently speaking on other changes like those to subscriptions (though seems a little worrying to be removing logic to avoid resending notifications to an already-published post?), but as far as this affects Publicize sync: I've rerun with/without recipe on both 4.8-alpha and 4.6.3 to check varying logic and can confirm my posts publicize correctly in all cases.
@@ -190,24 +202,27 @@ function filter_post_content_and_add_links( $post_object ) { | |||
* | |||
* @since 4.5.0 | |||
* | |||
* @param array of shortcode tags to remove. | |||
* @param array , of shortcode tags to remove. |
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.
Not clear why the comma was inserted here.
sync/class.jetpack-sync-sender.php
Outdated
@@ -77,6 +77,12 @@ private function continue_full_sync_enqueue() { | |||
} | |||
|
|||
public function do_sync() { | |||
/** |
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 comment needs to go.
I lest a minor comment. I think once update the change this PR is ready to go. |
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 is good to go!
* Readme: remove old release and add skeleton for 4.8. * Changelog: add #6572 * Changelog: add #6567 * Changelog: add #6542 * Changelog: add #6527 * Changelog: add #6508 * Changelog: add #6478 * Changelog: add #6477 * Changelog: add #6249 * Update stable version and remove old version from readme. * Changelog: add 4.7.1 to changelog. * Readme: add new contributor. * Sync: update docblock @SInCE version. Related: #6053 * Changelog: add release post. * changelog: add #6053 * Changelog: add #6413 * Changelog: add #6482 * Changelog: add #6584 * Changelog add #6603 * Changelog: add #6606 * Changelog: add #6611 * Changelog: add #6635 * Changelog: add #6639 * Changelog: add #6684 * Changelog: add #6710 * Changelog: add #6711 * Changelog: add #5461 * Testing list: update Settings UI feedback prompt. Props @MichaelArestad * Changelog: add #6789 * Changelog: add #6778 * Changelog: add #6777 * Changelog: add #6775 * Changelog: add #6755 * Changelog: add #6731 * Changelog: add #6721 * Changelog: add #6705 * Changelog: add #6702 * Changelog: add #6671 * Changelog: add #6637 * Changelog: add #6582 * Changelog: add #6566 * Changelog: add #6555 * Changelog: add #6529 * Changelog: add #6344 * Changelog: add #5763 * Changelog: add #5503 * Changelog: update #6637 changelog. @see 40e115c#commitcomment-21523982 * Changelog: add #6699 * Changelog: add #6632 * Changelog: add #6769 * Changelog: add #6707 * Changelog: add #6590
Fixes: https://github.com/Automattic/io/issues/19#issuecomment-281814105
Some plugins could hook into
save_post
andwp_insert_post
from within the hook.In that case we were clearing
$this->just_published
without waiting for the original post from being inserted.How to test:
Publishing a post containing an embedded recipe using the WP Recipe Maker plugin replicates the scenario pointed above.
See: https://github.com/Automattic/io/issues/19#issuecomment-281814105