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.
Looks like you have an extra empty line that will trip the parser.
sync/class.jetpack-sync-sender.php
Outdated
| } | ||
|
|
||
| public function do_sync() { | ||
| do_action( 'jetpack_sync_before_do_sync' ); |
There was a problem hiding this comment.
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( '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.
we need to remove this spaces, waiting for tests to pass first 😓
|
|
||
| wp_insert_post( $this->post->to_array() ); | ||
|
|
||
The previous solution doesn’t fix the issue for core < 4.7
aduth
left a comment
There was a problem hiding this comment.
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.
| * @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.
Not clear why the comma was inserted here.
sync/class.jetpack-sync-sender.php
Outdated
| } | ||
|
|
||
| public function do_sync() { | ||
| /** |
|
I lest a minor comment. I think once update the change this PR is ready 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_postandwp_insert_postfrom within the hook.In that case we were clearing
$this->just_publishedwithout 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