Comments: Avoid extra AJAX requests when undoing Spam or Trash actions.

Props afercia.
Fixes #35904.
Built from https://develop.svn.wordpress.org/trunk@36774


git-svn-id: http://core.svn.wordpress.org/trunk@36741 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2016-02-29 03:20:26 +00:00
parent 3cd78105dd
commit 2099e388bb
3 changed files with 8 additions and 4 deletions

View File

@ -286,6 +286,7 @@ setCommentsList = function() {
a.click(function( e ){
e.preventDefault();
e.stopPropagation(); // ticket #35904
list.wpList.del(this);
$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
$(this).remove();
@ -313,7 +314,8 @@ setCommentsList = function() {
approved = commentRow.hasClass( 'approved' ),
unapproved = commentRow.hasClass( 'unapproved' ),
spammed = commentRow.hasClass( 'spam' ),
trashed = commentRow.hasClass( 'trash' );
trashed = commentRow.hasClass( 'trash' ),
undoing = false; // ticket #35904
updateDashboardText( newTotal );
@ -347,6 +349,8 @@ setCommentsList = function() {
}
}
undoing = true;
// user clicked "Spam"
} else if ( targetParent.is( 'span.spam' ) ) {
// the comment is currently approved
@ -481,7 +485,7 @@ setCommentsList = function() {
}
}
if ( ! theExtraList || theExtraList.length === 0 || theExtraList.children().length === 0 ) {
if ( ! theExtraList || theExtraList.length === 0 || theExtraList.children().length === 0 || undoing ) {
return;
}

File diff suppressed because one or more lines are too long

View File

@ -4,7 +4,7 @@
*
* @global string $wp_version
*/
$wp_version = '4.5-beta1-36773';
$wp_version = '4.5-beta1-36774';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.