Coding Standards: Add missing braces to `if` conditions in `js/_enqueues/wp/util.js`.

Props ankitmaru.
Fixes #48980.
Built from https://develop.svn.wordpress.org/trunk@46960


git-svn-id: http://core.svn.wordpress.org/trunk@46760 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2019-12-15 08:45:05 +00:00
parent 1b675c6e4a
commit 35b29f11b3
2 changed files with 11 additions and 6 deletions

View File

@ -94,10 +94,13 @@ window.wp = window.wp || {};
deferred = $.Deferred( function( deferred ) {
// Transfer success/error callbacks.
if ( options.success )
if ( options.success ) {
deferred.done( options.success );
if ( options.error )
}
if ( options.error ) {
deferred.fail( options.error );
}
delete options.success;
delete options.error;
@ -105,13 +108,15 @@ window.wp = window.wp || {};
// Use with PHP's wp_send_json_success() and wp_send_json_error()
deferred.jqXHR = $.ajax( options ).done( function( response ) {
// Treat a response of 1 as successful for backward compatibility with existing handlers.
if ( response === '1' || response === 1 )
if ( response === '1' || response === 1 ) {
response = { success: true };
}
if ( _.isObject( response ) && ! _.isUndefined( response.success ) )
if ( _.isObject( response ) && ! _.isUndefined( response.success ) ) {
deferred[ response.success ? 'resolveWith' : 'rejectWith' ]( this, [response.data] );
else
} else {
deferred.rejectWith( this, [response] );
}
}).fail( function() {
deferred.rejectWith( this, arguments );
});

View File

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