Skip to content

Sync: Sync previous state when sycing post saves. #8443

Merged
enejb merged 10 commits intomasterfrom
update/sync-post-data
Jan 12, 2018
Merged

Sync: Sync previous state when sycing post saves. #8443
enejb merged 10 commits intomasterfrom
update/sync-post-data

Conversation

@enejb
Copy link
Copy Markdown
Member

@enejb enejb commented Jan 3, 2018

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:

  • Do the tests pass?
  • With the .com patch do you does you site still publicize and send subscription emails?
  • Does the data save and are you able to get the post to show up in related posts?

Proposed changelog entry for your changes:

@enejb enejb requested a review from a team as a code owner January 3, 2018 00:29
@enejb enejb changed the title Get the idea across Sync: Sync previous state when sycing post saves. Jan 3, 2018
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

does it make sense to keep this logic this side of the things?

@lezama
Copy link
Copy Markdown
Contributor

lezama commented Jan 3, 2018

+💯

@lezama
Copy link
Copy Markdown
Contributor

lezama commented Jan 3, 2018

I like the idea, also less code Jetpack side 👍

@enejb
Copy link
Copy Markdown
Member Author

enejb commented Jan 3, 2018

Related .com code D9089-code

gititon
gititon previously requested changes Jan 5, 2018
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why keep the wp_insert_post case below this, unless this won't handle all post types?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point! Will remove it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

make sense.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we consider simply sending a $state parameter that is an array with keys 'is_autosave', 'previous_state', etc.?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please remove this stray comment while you're in here?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stray comment.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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?

@enejb enejb force-pushed the update/sync-post-data branch from 5858374 to 64326c5 Compare January 8, 2018 19:02
@enejb enejb added [Status] Needs Review This PR is ready for review. and removed [Status] In Progress labels Jan 8, 2018
@enejb
Copy link
Copy Markdown
Member Author

enejb commented Jan 8, 2018

@gititon and @lezama Can you take a look at this again?

@lezama
Copy link
Copy Markdown
Contributor

lezama commented Jan 9, 2018

looks way cleaner now 💯 😍

let's ship it! we should merge .com side first

@lezama
Copy link
Copy Markdown
Contributor

lezama commented Jan 10, 2018

@enejb let's wait on another @gititon pass before merging!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

spacing

@lezama lezama force-pushed the update/sync-post-data branch from d48d519 to f12f1c0 Compare January 12, 2018 14:50
Copy link
Copy Markdown
Contributor

@roccotripaldi roccotripaldi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is testing well!

@enejb enejb dismissed gititon’s stale review January 12, 2018 17:09

changes fixed

Copy link
Copy Markdown
Member

@jeherve jeherve left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A small change to make the parser happy.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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!

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do. I had no idea we had such magic ❤️

Copy link
Copy Markdown
Contributor

@zinigor zinigor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes make sense, LGTM!

@zinigor zinigor added [Status] Ready to Merge Go ahead, you can push that green button! and removed [Status] Needs Review This PR is ready for review. labels Jan 12, 2018
enejb added 5 commits January 12, 2018 11:48
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/
@enejb enejb force-pushed the update/sync-post-data branch from f12f1c0 to 5f031f1 Compare January 12, 2018 19:48
@enejb enejb merged commit ccc5ce7 into master Jan 12, 2018
@enejb enejb deleted the update/sync-post-data branch January 12, 2018 20:10
@matticbot matticbot removed the [Status] Ready to Merge Go ahead, you can push that green button! label Jan 12, 2018
jeherve added a commit that referenced this pull request Jan 29, 2018
zinigor pushed a commit that referenced this pull request Jan 30, 2018
* 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.
lupus2k added a commit that referenced this pull request Jul 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants