Customize: Ensure autosave revision is dismissed immediately after implicit restoration notice dismissal as done with explicit notice dismissal.
Fixes issue where a drafted/scheduled changeset could inadvertently re-use the previous autosave revision in the preview while a user expects it to have been dismissed. See #39896, [41597]. Fixes #42502 for 4.9. Built from https://develop.svn.wordpress.org/branches/4.9@42145 git-svn-id: http://core.svn.wordpress.org/branches/4.9@41976 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
af74789be0
commit
389166f9aa
|
@ -8248,7 +8248,7 @@
|
|||
|
||||
// Set up initial notifications.
|
||||
(function() {
|
||||
var removedQueryParams = [];
|
||||
var removedQueryParams = [], autosaveDismissed = false;
|
||||
|
||||
/**
|
||||
* Obtain the URL to restore the autosave.
|
||||
|
@ -8294,6 +8294,25 @@
|
|||
history.replaceState( {}, document.title, urlParser.href );
|
||||
}
|
||||
|
||||
/**
|
||||
* Dismiss autosave.
|
||||
*
|
||||
* @returns {void}
|
||||
*/
|
||||
function dismissAutosave() {
|
||||
if ( autosaveDismissed ) {
|
||||
return;
|
||||
}
|
||||
wp.ajax.post( 'customize_dismiss_autosave_or_lock', {
|
||||
wp_customize: 'on',
|
||||
customize_theme: api.settings.theme.stylesheet,
|
||||
customize_changeset_uuid: api.settings.changeset.uuid,
|
||||
nonce: api.settings.nonce.dismiss_autosave_or_lock,
|
||||
dismiss_autosave: true
|
||||
} );
|
||||
autosaveDismissed = true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Add notification regarding the availability of an autosave to restore.
|
||||
*
|
||||
|
@ -8319,15 +8338,7 @@
|
|||
} );
|
||||
|
||||
// Handle dismissal of notice.
|
||||
li.find( '.notice-dismiss' ).on( 'click', function() {
|
||||
wp.ajax.post( 'customize_dismiss_autosave_or_lock', {
|
||||
wp_customize: 'on',
|
||||
customize_theme: api.settings.theme.stylesheet,
|
||||
customize_changeset_uuid: api.settings.changeset.uuid,
|
||||
nonce: api.settings.nonce.dismiss_autosave_or_lock,
|
||||
dismiss_autosave: true
|
||||
} );
|
||||
} );
|
||||
li.find( '.notice-dismiss' ).on( 'click', dismissAutosave );
|
||||
|
||||
return li;
|
||||
}
|
||||
|
@ -8335,6 +8346,7 @@
|
|||
|
||||
// Remove the notification once the user starts making changes.
|
||||
onStateChange = function() {
|
||||
dismissAutosave();
|
||||
api.notifications.remove( code );
|
||||
api.unbind( 'change', onStateChange );
|
||||
api.state( 'changesetStatus' ).unbind( onStateChange );
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -4,7 +4,7 @@
|
|||
*
|
||||
* @global string $wp_version
|
||||
*/
|
||||
$wp_version = '4.9-RC2-42141';
|
||||
$wp_version = '4.9-RC2-42145';
|
||||
|
||||
/**
|
||||
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.
|
||||
|
|
Loading…
Reference in New Issue