When clicking "Show More Comments" in the Comments meta box on the Edit Post screen, change the click behavior to call a new class method on commentsBox, ->load(), that resets st (cool name) to the number of visible <tr>s before calling ->get(). This will account for spam'd and trash'd comments when returning comments at the proper offset.

Props utkarshpatel.
Fixes #33829.


git-svn-id: https://develop.svn.wordpress.org/trunk@34069 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Scott Taylor
2015-09-12 02:27:50 +00:00
parent f855ddb134
commit 0f2078bc9e
3 changed files with 7 additions and 2 deletions

View File

@@ -690,7 +690,7 @@ function post_comment_meta_box( $post ) {
}
?>
<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.get(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p>
<p class="hide-if-no-js" id="show-comments"><a href="#commentstatusdiv" onclick="commentsBox.load(<?php echo $total; ?>);return false;"><?php _e('Show comments'); ?></a> <span class="spinner"></span></p>
<?php
}

View File

@@ -59,6 +59,11 @@ commentsBox = {
);
return false;
},
load: function(total){
this.st = jQuery('#the-comment-list tr.comment:visible').length;
this.get(total);
}
};

View File

@@ -853,7 +853,7 @@ function get_comment_text( $comment_ID = 0, $args = array() ) {
function comment_text( $comment_ID = 0, $args = array() ) {
$comment = get_comment( $comment_ID );
$comment_text = get_comment_text( $comment_ID , $args );
$comment_text = get_comment_text( $comment, $args );
/**
* Filter the text of a comment to be displayed.
*