Comments: Avoid extra AJAX requests when undoing Spam or Trash actions.
Props afercia. Fixes #35904. git-svn-id: https://develop.svn.wordpress.org/trunk@36774 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
ea2d437b6b
commit
f188597025
@ -286,6 +286,7 @@ setCommentsList = function() {
|
|||||||
|
|
||||||
a.click(function( e ){
|
a.click(function( e ){
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
e.stopPropagation(); // ticket #35904
|
||||||
list.wpList.del(this);
|
list.wpList.del(this);
|
||||||
$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
|
$('#undo-' + id).css( {backgroundColor:'#ceb'} ).fadeOut(350, function(){
|
||||||
$(this).remove();
|
$(this).remove();
|
||||||
@ -313,7 +314,8 @@ setCommentsList = function() {
|
|||||||
approved = commentRow.hasClass( 'approved' ),
|
approved = commentRow.hasClass( 'approved' ),
|
||||||
unapproved = commentRow.hasClass( 'unapproved' ),
|
unapproved = commentRow.hasClass( 'unapproved' ),
|
||||||
spammed = commentRow.hasClass( 'spam' ),
|
spammed = commentRow.hasClass( 'spam' ),
|
||||||
trashed = commentRow.hasClass( 'trash' );
|
trashed = commentRow.hasClass( 'trash' ),
|
||||||
|
undoing = false; // ticket #35904
|
||||||
|
|
||||||
updateDashboardText( newTotal );
|
updateDashboardText( newTotal );
|
||||||
|
|
||||||
@ -347,6 +349,8 @@ setCommentsList = function() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
undoing = true;
|
||||||
|
|
||||||
// user clicked "Spam"
|
// user clicked "Spam"
|
||||||
} else if ( targetParent.is( 'span.spam' ) ) {
|
} else if ( targetParent.is( 'span.spam' ) ) {
|
||||||
// the comment is currently approved
|
// 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;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user