Opened 6 years ago
Last modified 6 years ago
#46963 new defect (bug)
Comments meta box offset bug for custom comment types
Reported by: | mikejolley | Owned by: | |
---|---|---|---|
Milestone: | Awaiting Review | Priority: | normal |
Severity: | normal | Version: | |
Component: | Comments | Keywords: | has-patch needs-testing |
Focuses: | ui, administration | Cc: |
Description
There is a conflict in the 'comments' meta box when used in combination with custom comment types.
The Show more comments
link loads duplicates, without an offset due to this line of code:
this.st = jQuery('#the-comment-list tr.comment:visible').length;
For custom comment types, the comment
class may not exist. See how comment classes are generated here:
<?php $classes[] = ( empty( $comment->comment_type ) ) ? 'comment' : $comment->comment_type;
You can see an example of this with WooCommerce which uses a comment type named 'review' (https://github.com/woocommerce/woocommerce/issues/23313). Because the comments out output without the comment
class and instead they have a review
class, the JS code fails to set the correct offset.
Possible solutions:
- Output
comment
class for custom comment types in addition to their custom class. - Revise jquery selector to be more generic e.g. count the
tr
elements instead.
Attachments (2)
Change History (5)
@
6 years ago
In the above patch, file patch is not included so I have created another patch. Please consider this new patch for this issue.
I have fixed the "Comments meta box offset bug for custom comment types" issue.