Customize: Ensure `changeset_uuid` param for autosave auto-draft gets stripped from location after previewing theme switch when not in branching mode.

Amends [41597].
See #39896.
Fixes #42415.


git-svn-id: https://develop.svn.wordpress.org/trunk@42114 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Weston Ruter 2017-11-03 17:36:27 +00:00
parent c7cb694732
commit 9976cd2b66
1 changed files with 8 additions and 3 deletions

View File

@ -8248,6 +8248,7 @@
// Set up initial notifications.
(function() {
var removedQueryParams = [];
/**
* Obtain the URL to restore the autosave.
@ -8344,9 +8345,13 @@
if ( api.settings.changeset.autosaved ) {
api.state( 'saved' ).set( false );
stripParamsFromLocation( [ 'customize_autosaved' ] ); // Remove param when restoring autosave revision.
} else if ( ! api.settings.changeset.branching && 'auto-draft' === api.settings.changeset.status ) {
stripParamsFromLocation( [ 'changeset_uuid' ] ); // Remove UUID when restoring autosave auto-draft.
removedQueryParams.push( 'customize_autosaved' );
}
if ( ! api.settings.changeset.branching && ( ! api.settings.changeset.status || 'auto-draft' === api.settings.changeset.status ) ) {
removedQueryParams.push( 'changeset_uuid' ); // Remove UUID when restoring autosave auto-draft.
}
if ( removedQueryParams.length > 0 ) {
stripParamsFromLocation( removedQueryParams );
}
if ( api.settings.changeset.latestAutoDraftUuid || api.settings.changeset.hasAutosaveRevision ) {
addAutosaveRestoreNotification();