Customize: Temporary fix for autosave restore notice not being removed

Fixes the "There is a more recent autosave of your changes" notice from not
being removed when the dismiss button is clicked.

The problem is caused by the notice being initialized twice: once by the
`common` script and then again by the `customize-controls` script.

This temporary fix prevents `customize-controls` from initializing a notice if
it has already been initialized.

A better fix would be to not initialize notices twice. This can be done by
removing `common` as a dependency of `updates` when `deprecateL10nObject` is
removed.

When this happens (est: 5.7), this temporary fix should be reverted.

Fixes #51425.
See #51317.
Props karthikbhatb, dlh, SergeyBiryukov.

Built from https://develop.svn.wordpress.org/trunk@49625


git-svn-id: http://core.svn.wordpress.org/trunk@49363 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
noisysocks 2020-11-17 04:45:11 +00:00
parent a3c8b3ddea
commit 9f065de733
3 changed files with 6 additions and 2 deletions

View File

@ -1094,6 +1094,10 @@ $document.ready( function() {
var $el = $( this ), var $el = $( this ),
$button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' ); $button = $( '<button type="button" class="notice-dismiss"><span class="screen-reader-text"></span></button>' );
if ( $el.find( '.notice-dismiss' ).length ) {
return;
}
// Ensure plain text. // Ensure plain text.
$button.find( '.screen-reader-text' ).text( __( 'Dismiss this notice.' ) ); $button.find( '.screen-reader-text' ).text( __( 'Dismiss this notice.' ) );
$button.on( 'click.wp-dismiss-notice', function( event ) { $button.on( 'click.wp-dismiss-notice', function( event ) {

File diff suppressed because one or more lines are too long

View File

@ -13,7 +13,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '5.6-beta4-49624'; $wp_version = '5.6-beta4-49625';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.