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

Delete all customize-draft posts that are referenced by a given changeset post that is deleted #329

Closed
westonruter opened this Issue Dec 11, 2016 · 4 comments

Comments

Projects
None yet
2 participants
@westonruter
Member

westonruter commented Dec 11, 2016

When we save a changeset (snapshot) as a draft, we go through and transition any related auto-draft-status posts to customize-draft. This is to prevent the posts referenced in the changeset from erroneously garbage-collected when the changeset itself is persistent. However, what we're not accounting for is the case when the changeset itself is deleted without ever having been published. What we're not doing is deleting all of these related customize-draft-status posts and so they are going to be sticking around forever, orphaned from any changeset.

@westonruter westonruter added the bug label Dec 11, 2016

@PatelUtkarsh

This comment has been minimized.

Show comment
Hide comment
@PatelUtkarsh

PatelUtkarsh Dec 11, 2016

Collaborator

In orphan logic, we need to make sure we check for a fork and merge snapshot and don't delete the post in that case.

Collaborator

PatelUtkarsh commented Dec 11, 2016

In orphan logic, we need to make sure we check for a fork and merge snapshot and don't delete the post in that case.

@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Jan 26, 2017

Member

I think we could potentially eliminate the separate customize-draft status by instead making use of a far-future post_date for the auto-draft posts.

See #39715: Customize: Keep alive auto-drafts created for page/post stubs, and delete when changeset is garbage-collected

There is a proof of concept for nav_menus_created_posts: https://core.trac.wordpress.org/attachment/ticket/39715/proof-of-concept.php

Note that this doesn't address the problem of forks.

Member

westonruter commented Jan 26, 2017

I think we could potentially eliminate the separate customize-draft status by instead making use of a far-future post_date for the auto-draft posts.

See #39715: Customize: Keep alive auto-drafts created for page/post stubs, and delete when changeset is garbage-collected

There is a proof of concept for nav_menus_created_posts: https://core.trac.wordpress.org/attachment/ticket/39715/proof-of-concept.php

Note that this doesn't address the problem of forks.

@PatelUtkarsh PatelUtkarsh self-assigned this Feb 22, 2017

@PatelUtkarsh

This comment has been minimized.

Show comment
Hide comment
@PatelUtkarsh

PatelUtkarsh Feb 22, 2017

Collaborator

Should we also delete auto-draft post (Or change its date to clean up) in the case of a changeset is trashed?

How should we go about this @westonruter using auto-draft or keep using customize-draft?

Collaborator

PatelUtkarsh commented Feb 22, 2017

Should we also delete auto-draft post (Or change its date to clean up) in the case of a changeset is trashed?

How should we go about this @westonruter using auto-draft or keep using customize-draft?

@westonruter

This comment has been minimized.

Show comment
Hide comment
@westonruter

westonruter Feb 22, 2017

Member

@PatelUtkarsh isn't this already accounted for by delete_changeset_nav_menus_created_auto_draft_posts in the proof of concept? It skips rolling back the post_date of related auto-draft posts upon trashing by instead just waiting to delete the posts until the changeset is deleted entirely.

And yes, using this technique of setting the post_date for auto-draft posts far into into future will allow us to eliminate the separate customize-draft status entirely.

Member

westonruter commented Feb 22, 2017

@PatelUtkarsh isn't this already accounted for by delete_changeset_nav_menus_created_auto_draft_posts in the proof of concept? It skips rolling back the post_date of related auto-draft posts upon trashing by instead just waiting to delete the posts until the changeset is deleted entirely.

And yes, using this technique of setting the post_date for auto-draft posts far into into future will allow us to eliminate the separate customize-draft status entirely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment