Skip to content
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

Remove sessionStorage and use changeset to save post editor screen data. #350

Merged
merged 24 commits into from Apr 25, 2017

Conversation

Projects
None yet
2 participants
@sayedtaqui
Copy link
Collaborator

commented Apr 6, 2017

Fixes #338


wp.customize.Loader.open( component.data.customize_url );
wp.customize.Loader.settings.browser.mobile = wasMobile;

This comment has been minimized.

Copy link
@westonruter

westonruter Apr 7, 2017

Contributor

I think this needs to be put right after each of the wp.customize.Loader.open calls, especially the second since it is async.

global $wp_customize;
$previewed_post_id = absint( wp_unslash( $_POST['previewed_post'] ) );
$changeset_uuid = get_post_meta( $previewed_post_id, '_changeset_uuid', true );

This comment has been minimized.

Copy link
@westonruter

westonruter Apr 7, 2017

Contributor

Maybe _preview_changeset_uuid would be better.

sayedtaqui added some commits Apr 7, 2017

Delete _preview_changeset_uuid from post meta after the changeset is …
…published, add checks for publish changeset and review feedback.

@sayedtaqui sayedtaqui changed the title [WIP] Remove sessionStorage and use changeset to save post editor screen data. Remove sessionStorage and use changeset to save post editor screen data. Apr 12, 2017

wp_unslash( $_POST['customize_url'] )
);
$wp_customize_posts = new WP_Customize_Posts( $wp_customize );

This comment has been minimized.

Copy link
@westonruter

westonruter Apr 22, 2017

Contributor

Wouldn't we be able to use $wp_customize->posts here?

This comment has been minimized.

Copy link
@sayedtaqui

sayedtaqui Apr 22, 2017

Author Collaborator

Absolutely, that's what I had done first but then phpStorm was not able to recognize $wp_customize->posts, so.. that's probably a weird reason.

This comment has been minimized.

Copy link
@westonruter

westonruter Apr 22, 2017

Contributor

Yeah, you're right. It's because Customize Posts is adding the posts property without it being declared. So I added a workaround here by adding an explicit type declaration.

wp_send_json_error( 'missing_input_data' );
}
$previewed_post_id = intval( wp_unslash( $_POST['previewed_post'] ) );

This comment has been minimized.

Copy link
@westonruter

westonruter Apr 22, 2017

Contributor

Note that this was previously absint. The use of this is function to sanitize integers is being discouraged in core now in favor of intval so that negative numbers won't get silently converted into something that could be a real post.

@westonruter
Copy link
Contributor

left a comment

@sayedtaqui The experience here when previewing a post in the customizer is way better with your changes here. 🎉

Check out my changes and if they get your 👍 feel free to merge.

@westonruter

This comment has been minimized.

Copy link
Contributor

commented Apr 22, 2017

Oh, adding a unit test for Edit_Post_Preview::update_post_changeset() wouldn't be a bad idea.

@sayedtaqui

This comment has been minimized.

Copy link
Collaborator Author

commented Apr 25, 2017

@westonruter Please review my changes, ( Dont have merge access )

@westonruter westonruter merged commit 538d6f8 into develop Apr 25, 2017

2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

@westonruter westonruter deleted the enhancements/issue-338 branch Apr 25, 2017

@westonruter westonruter added this to the 0.8.6 milestone Jun 7, 2017

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.