diff --git a/src/wp-admin/css/customize-controls.css b/src/wp-admin/css/customize-controls.css index f1962acf5d..b888f610bb 100644 --- a/src/wp-admin/css/customize-controls.css +++ b/src/wp-admin/css/customize-controls.css @@ -2030,7 +2030,7 @@ p.customize-section-description { display: none; } -.themes-section-installed_themes .theme .notice-success { +.themes-section-installed_themes .theme .notice-success:not(.updated-message) { display: none; /* Hide "installed" notice on installed themes tab. */ } diff --git a/src/wp-admin/js/customize-controls.js b/src/wp-admin/js/customize-controls.js index d9554618f2..365a99d8d6 100644 --- a/src/wp-admin/js/customize-controls.js +++ b/src/wp-admin/js/customize-controls.js @@ -3347,7 +3347,10 @@ api.control.each( function( control ) { if ( 'theme' === control.params.type && control.params.theme.id === response.slug ) { control.params.theme.hasUpdate = false; - control.rerenderAsInstalled( true ); + control.params.theme.version = response.newVersion; + setTimeout( function() { + control.rerenderAsInstalled( true ); + }, 2000 ); } }); } ); diff --git a/src/wp-admin/js/updates.js b/src/wp-admin/js/updates.js index b62c1de869..2b5ba92913 100644 --- a/src/wp-admin/js/updates.js +++ b/src/wp-admin/js/updates.js @@ -937,12 +937,12 @@ } else if ( 'customize' === pagenow ) { // Update the theme details UI. - $notice = $( '#update-theme' ).closest( '.notice' ).removeClass( 'notice-large' ); + $notice = $( '[data-slug="' + args.slug + '"].notice' ).removeClass( 'notice-large' ); $notice.find( 'h3' ).remove(); // Add the top-level UI, and update both. - $notice = $notice.add( $( '#customize-control-theme-installed_' + args.slug ).find( '.update-message' ) ); + $notice = $notice.add( $( '#customize-control-installed_theme_' + args.slug ).find( '.update-message' ) ); $notice = $notice.addClass( 'updating-message' ).find( 'p' ); } else { @@ -988,10 +988,17 @@ $notice, newText; if ( 'customize' === pagenow ) { - $theme = wp.customize.control( 'installed_theme_' + response.slug ).container; - } + $theme = $( '.updating-message' ).siblings( '.theme-name' ); - if ( 'themes-network' === pagenow ) { + if ( $theme.length ) { + + // Update the version number in the row. + newText = $theme.html().replace( response.oldVersion, response.newVersion ); + $theme.html( newText ); + } + + $notice = $( '.theme-info .notice' ).add( wp.customize.control( 'installed_theme_' + response.slug ).container.find( '.theme' ).find( '.update-message' ) ); + } else if ( 'themes-network' === pagenow ) { $notice = $theme.find( '.update-message' ); // Update the version number in the row. @@ -1016,7 +1023,7 @@ $document.trigger( 'wp-theme-update-success', response ); // Show updated message after modal re-rendered. - if ( isModalOpen ) { + if ( isModalOpen && 'customize' !== pagenow ) { $( '.theme-info .theme-author' ).after( wp.updates.adminNotice( updatedMessage ) ); } }; @@ -1046,7 +1053,7 @@ } if ( 'customize' === pagenow ) { - $theme = wp.customize.control( 'installed_theme_' + response.slug ).container; + $theme = wp.customize.control( 'installed_theme_' + response.slug ).container.find( '.theme' ); } if ( 'themes-network' === pagenow ) { diff --git a/src/wp-includes/class-wp-customize-manager.php b/src/wp-includes/class-wp-customize-manager.php index 5dfc5bd7d0..12256d2173 100644 --- a/src/wp-includes/class-wp-customize-manager.php +++ b/src/wp-includes/class-wp-customize-manager.php @@ -4276,6 +4276,9 @@ final class WP_Customize_Manager { if ( ! is_multisite() && ( current_user_can( 'install_themes' ) || current_user_can( 'update_themes' ) || current_user_can( 'delete_themes' ) ) ) { wp_enqueue_script( 'updates' ); + wp_localize_script( 'updates', '_wpUpdatesItemCounts', array( + 'totals' => wp_get_update_data(), + ) ); } }