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

Split snapshot #118

Closed
wants to merge 10 commits into from
Closed

Split snapshot #118

wants to merge 10 commits into from

Conversation

PatelUtkarsh
Copy link
Member

Fixes #16

@PatelUtkarsh PatelUtkarsh changed the title [WIP] Split snapshot Split snapshot Feb 22, 2017
@westonruter westonruter modified the milestone: Next Major Release Mar 10, 2017
@valendesigns
Copy link
Contributor

@PatelUtkarsh Please fix merge conflicts so I can review. Thanks!

@coveralls
Copy link

coveralls commented Aug 23, 2017

Coverage Status

Coverage increased (+0.4%) to 75.26% when pulling 2cdc17b on feature/split-snapshot into 1784a74 on develop.

@PatelUtkarsh
Copy link
Member Author

PatelUtkarsh commented Dec 14, 2017

Todo:

  • test

$this->split_snapshot_id = wp_insert_post( $new_post_arr );
$this->split_processing_post_id = $post->ID;
$this->restore_kses();
$content = Customize_Snapshot_Manager::encode_json( $data );
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs to be wrapped in wp_slash()

if ( $should_allow_split ) {
$split_text = __( 'Split', 'customize-snapshots' );
echo sprintf( '<button id="split-activate" class="button button-secondary" data-cancel-text="%s" data-original-text="%s">%s</button>',
esc_html__( 'Cancel Split', 'customize-snapshots' ), esc_attr( $split_text ), esc_html( $split_text ) );
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's reformat the sprintf() here so that each of its args are on a separate line.

$this->split_processing_post_id = $post->ID;
$this->restore_kses();
$content = Customize_Snapshot_Manager::encode_json( $data );
add_action( 'post_updated', array( $this, 'redirect_split_post' ), 100 );
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe this should happen at shutdown instead?

$this->suspend_kses();
// Remove key so it doesn't save recursively.
unset( $_REQUEST[ $split_key ], $_POST[ $split_key ] );
$this->split_snapshot_id = wp_insert_post( $new_post_arr );
Copy link
Contributor

Choose a reason for hiding this comment

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

$new_post_arr here needs to be wrapped in wp_slash()

);
$theme = get_post_meta( $post->ID, '_snapshot_theme', true );
if ( ! empty( $theme ) ) {
$new_post_arr['meta_input']['_snapshot_theme'] = $theme;
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we include meta about the source changeset that it came from? Wouldn't this be like a fork?

Copy link
Member Author

Choose a reason for hiding this comment

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

We can add it, But where would we use it? If we are showing source from where changeset was split from that would work. Should i add that? @westonruter

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.

Allow a snapshot to be split up into multiple snapshots
4 participants