From 9976cd2b66f8e0ed91c90763bfd53861806ee120 Mon Sep 17 00:00:00 2001 From: Weston Ruter Date: Fri, 3 Nov 2017 17:36:27 +0000 Subject: [PATCH] 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 --- src/wp-admin/js/customize-controls.js | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index fbb8f42959..bd48ebe652 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -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();