Administration: Remove wp-auth-check from the Heartbeat API.

As of [27153], wp-auth-check is returned on all heartbeats without the need for data from client-side. This also means that the timing and scheduling of this request data is ineffectual.

Fixes #50305.

Props dsixinetu, azaozz, whyisjake.



git-svn-id: https://develop.svn.wordpress.org/trunk@48056 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Jake Spurlock 2020-06-16 07:07:54 +00:00
parent def933ced7
commit cbc71bb1a1
2 changed files with 1 additions and 41 deletions

View File

@ -6,7 +6,7 @@
/* global adminpage */
(function($){
var wrap, next;
var wrap;
/**
* Shows the authentication form popup.
@ -110,18 +110,6 @@
});
}
/**
* Schedules when the next time the authentication check will be done.
*
* @since 3.6.0
* @private
*/
function schedule() {
// In seconds, default 3 min.
var interval = parseInt( window.authcheckL10n.interval, 10 ) || 180;
next = ( new Date() ).getTime() + ( interval * 1000 );
}
/**
* Binds to the Heartbeat Tick event.
*
@ -138,31 +126,13 @@
*/
$( document ).on( 'heartbeat-tick.wp-auth-check', function( e, data ) {
if ( 'wp-auth-check' in data ) {
schedule();
if ( ! data['wp-auth-check'] && wrap.hasClass('hidden') ) {
show();
} else if ( data['wp-auth-check'] && ! wrap.hasClass('hidden') ) {
hide();
}
}
/**
* Binds to the Heartbeat Send event.
*
* @ignore
*
* @since 3.6.0
*
* @param {Object} e The heartbeat-send event that has been triggered.
* @param {Object} data Response data.
*/
}).on( 'heartbeat-send.wp-auth-check', function( e, data ) {
if ( ( new Date() ).getTime() > next ) {
data['wp-auth-check'] = true;
}
}).ready( function() {
schedule();
/**
* Hides the authentication form popup when the close icon is clicked.

View File

@ -719,16 +719,6 @@ function wp_default_scripts( $scripts ) {
'authcheckL10n',
array(
'beforeunload' => __( 'Your session has expired. You can log in again from this page or go to the login page.' ),
/**
* Filters the authentication check interval.
*
* @since 3.6.0
*
* @param int $interval The interval in which to check a user's authentication.
* Default 3 minutes in seconds, or 180.
*/
'interval' => apply_filters( 'wp_auth_check_interval', 3 * MINUTE_IN_SECONDS ),
)
);