Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Use auto-draft with late future date instead of customize-draft and clean auto-draft on changeset delete. #348

Merged
merged 14 commits into from Mar 3, 2017

Conversation

PatelUtkarsh
Copy link
Member

@PatelUtkarsh PatelUtkarsh commented Feb 28, 2017

Fixes #329

  • Test Use-cases.
  • Write unit-test for Clean up posts on changeset delete.

continue;
}

// Confirm this is the only post setting.
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe, “Confirm that this changeset is the only one which references this post so it is cleared for garbage collection.”

foreach ( $settings_data as $setting_key => $val ) {
if ( preg_match( WP_Customize_Post_Setting::SETTING_ID_PATTERN, $setting_key, $matches ) ) {
$setting_post = get_post( $matches['post_id'] );
if ( ! in_array( $setting_post->post_status, $status_to_delete, true ) ) {
Copy link
Contributor

Choose a reason for hiding this comment

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

This should check if $setting_post is not empty, as it could have already been deleted somehow.

public function cleanup_autodraft_on_changeset_delete( $post_id ) {
global $wpdb;
$post = get_post( $post_id );
$allowed_snapshot_status = array( 'customize_changeset', 'customize_snapshot' );
Copy link
Contributor

Choose a reason for hiding this comment

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

$post_types?

@PatelUtkarsh PatelUtkarsh changed the title [WIP] Use auto-draft with late future date instead of customize-draft and clean auto-draft on changeset delete. Use auto-draft with late future date instead of customize-draft and clean auto-draft on changeset delete. Mar 2, 2017
@westonruter westonruter added this to the Next Minor Release milestone Mar 3, 2017
@westonruter westonruter merged commit 04cb643 into develop Mar 3, 2017
@westonruter westonruter deleted the fix/cleanup-draft branch March 3, 2017 07:24
@westonruter westonruter modified the milestones: Next Minor Release, 0.8.6 Jun 7, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants