Skip to content

Commit ca1d263

Browse files
committed
Comments: Fix "Show more comments" button for custom comment types.
The comments metabox assumed all comment `<tr>` elements carry the `comment` class, which is not the case for custom comment types such as WooCommerce reviews. Match rows by an id starting with `comment-` instead, so regular comments and custom comment types are both counted. Also correct the default number of comments requested in the AJAX call from 20 to 10, aligning the frontend with the backend, which falls back to 10. The mismatch made the frontend believe all comments were already loaded when they were not. Props Aljullu, PavloBorysenko, tyxla. Fixes #65392. git-svn-id: https://develop.svn.wordpress.org/trunk@62624 602fd350-edb4-49c9-b593-d223f7449a82
1 parent e9ee595 commit ca1d263

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

src/js/_enqueues/admin/post.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,13 @@ window.wp = window.wp || {};
3535
* @memberof commentsBox
3636
*
3737
* @param {number} total Total number of comments for this post.
38-
* @param {number} num Optional. Number of comments to fetch, defaults to 20.
38+
* @param {number} num Optional. Number of comments to fetch, defaults to 10.
3939
* @return {boolean} Always returns false.
4040
*/
4141
get : function(total, num) {
4242
var st = this.st, data;
4343
if ( ! num )
44-
num = 20;
44+
num = 10;
4545

4646
this.st += num;
4747
this.total = total;
@@ -97,7 +97,7 @@ window.wp = window.wp || {};
9797
* @param {number} total Total number of comments to load.
9898
*/
9999
load: function(total){
100-
this.st = jQuery('#the-comment-list tr.comment:visible').length;
100+
this.st = jQuery('#the-comment-list tr[id^="comment-"]:visible').length;
101101
this.get(total);
102102
}
103103
};

0 commit comments

Comments
 (0)