Site Health: Remove Ajax requests from dashboard widget.

The Site Health dashboard widget uses the same JavaScript file as the Site Health pages to generate its progress indicator.

This file was also set up to store the current Site Health check results if the current tab being shown isn't the debug information one, this had the side effect of the dashboard being seen as not the debug screen as well.

This now has a conditional making sure it's the status screen it self being displayed, before trying to do any Ajax requests.

Props arena.
Fixes #49814.
Built from https://develop.svn.wordpress.org/trunk@50766


git-svn-id: http://core.svn.wordpress.org/trunk@50375 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Clorith 2021-04-17 11:29:02 +00:00
parent 954842868f
commit f7536fd387
4 changed files with 6 additions and 5 deletions

View File

@ -12,6 +12,7 @@ jQuery( function( $ ) {
_n = wp.i18n._n,
sprintf = wp.i18n.sprintf,
clipboard = new ClipboardJS( '.site-health-copy-buttons .copy-button' ),
isStatusTab = $( '.health-check-body.health-check-status-tab' ).length,
isDebugTab = $( '.health-check-body.health-check-debug-tab' ).length,
pathsSizesSection = $( '#health-check-accordion-block-wp-paths-sizes' ),
successTimeout;
@ -229,7 +230,7 @@ jQuery( function( $ ) {
wp.a11y.speak( __( 'All site health tests have finished running. There are items that should be addressed, and the results are now available on the page.' ) );
}
if ( ! isDebugTab ) {
if ( isStatusTab ) {
$.post(
ajaxurl,
{
@ -346,7 +347,7 @@ jQuery( function( $ ) {
appendIssue( wp.hooks.applyFilters( 'site_status_test_result', issue ) );
}
if ( 'undefined' !== typeof SiteHealth && ! isDebugTab ) {
if ( 'undefined' !== typeof SiteHealth ) {
if ( 0 === SiteHealth.site_status.direct.length && 0 === SiteHealth.site_status.async.length ) {
recalculateProgression();
} else {

File diff suppressed because one or more lines are too long

View File

@ -195,7 +195,7 @@ if ( isset( $_GET['tab'] ) && ! empty( $_GET['tab'] ) ) {
<p><?php _e( 'The Site Health check requires JavaScript.' ); ?></p>
</div>
<div class="health-check-body hide-if-no-js">
<div class="health-check-body health-check-status-tab hide-if-no-js">
<div class="site-status-all-clear hide">
<p class="icon">
<span class="dashicons dashicons-yes"></span>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.8-alpha-50765';
$wp_version = '5.8-alpha-50766';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.