Sync: Sync previous state when sycing post saves. #8443
Conversation
There was a problem hiding this comment.
does it make sense to keep this logic this side of the things?
|
+💯 |
|
I like the idea, also less code Jetpack side 👍 |
c26a4bd to
5d5d036
Compare
|
Related .com code D9089-code |
There was a problem hiding this comment.
why keep the wp_insert_post case below this, unless this won't handle all post types?
There was a problem hiding this comment.
Good point! Will remove it.
There was a problem hiding this comment.
Previously, $just_published was a boolean, which made sense because we were specifying whether $just_published was true or false. With your changes, I'm not sure it makes sense to continue to assign a boolean to $previous_state. It might make more sense to assign a constant representing the previous state to $previous_state instead.
There was a problem hiding this comment.
Should we consider simply sending a $state parameter that is an array with keys 'is_autosave', 'previous_state', etc.?
There was a problem hiding this comment.
I didn't want to change things up to much. In terms of what the data shape is that we pass back. But now is the time to do that. I think we could definitely do that.
There was a problem hiding this comment.
Can you please remove this stray comment while you're in here?
There was a problem hiding this comment.
Is one of these lines (either 91 or 92) the current state and one of them the previous state? If so, can we identify them in the object as such?
5858374 to
64326c5
Compare
|
looks way cleaner now 💯 😍 let's ship it! we should merge .com side first |
d48d519 to
f12f1c0
Compare
roccotripaldi
left a comment
There was a problem hiding this comment.
This is testing well!
jeherve
left a comment
There was a problem hiding this comment.
A small change to make the parser happy.
There was a problem hiding this comment.
Could you add the @module sync text to you Sync hooks, so it gets categorized by the parser?
https://developer.jetpack.com/module/sync/
Thank you!
There was a problem hiding this comment.
Will do. I had no idea we had such magic ❤️
zinigor
left a comment
There was a problem hiding this comment.
Changes make sense, LGTM!
Sync previous state with in the wp_insert_post
I did a bit of digging and it turns out that we use both convetions. Lets stick with jetpack_sync_* since clearly the action is being used for sync.
This will categorize the sync action for https://developer.jetpack.com/module/sync/
f12f1c0 to
5f031f1
Compare
* Changelog 5.8: create base for changelog. * Update 5.8 release post link * fix 5.8 release date * Updates to plugin description * Changelog: add #8499 * Changelog: add #8506 * Changelog: add #8509 * Changelog: add #8516 * Changelog: add #8517 * Changelog: add #8523 * Changelog: add #8547 * Changelog: add #8496 * Changelog: add #8584 * Changelog: add #8595 * Changelog: add #8445 * Changelog: add #8431 * Changelog: add #8284 * Changelog: add #8270 * Changelog: add #8124 * Changelog: add #8581 * Changelog: add #8463 * Changelog: add #8568 (#8646) * Updates to testing list and changelog * Changelog: add #8443 * Changelog: add #8459 * Changelog: add #8469 * Changelog: add #8464 * Changelog: add #8478 and #8479 * Changelog: add #8483 * Changelog: add #8488 * Changelog: add #8513 * Changelog: add #8555 * Changelog: add #8565 * Changelog: add #8601 * Changelog: add #8612 * Changelog: add first pass at Search items. * Changelog: add more info to help test Search. * Changelog: add #8144 * Changelog: add #8313 * Changelog: add #8419 * Changelog: add #8465 * Changelog: add #8515 * Changelog: add #8587 * Changelog: add #8591 * Changelog: add #8659 * Changelog: add #8661 * Changelog: add #8671 * Changelog: add 5.7.1 to archived changelog too. * Reverted changes to readme, removed entry about backups.
Sync previous state with in the wp_insert_post
Currently we don't have a good way to tell what the previous state was previous state with we sync posts.
Creating a new action would help keep things backwards compatible.
Changes proposed in this Pull Request:
Testing instructions:
Proposed changelog entry for your changes: