[wp-trac] [WordPress Trac] #40188: Filter button should not appear when no comments are available in list

WordPress Trac noreply at wordpress.org
Tue Jul 21 11:51:04 UTC 2020


#40188: Filter button should not appear when no comments are available in list
-------------------------------------------------+-------------------------
 Reporter:  swissspidy                           |       Owner:  Jim_Panse
     Type:  defect (bug)                         |      Status:  closed
 Priority:  normal                               |   Milestone:  5.5
Component:  Comments                             |     Version:
 Severity:  normal                               |  Resolution:  fixed
 Keywords:  good-first-bug has-patch has-unit-   |     Focuses:  ui,
  tests needs-dev-note                           |  administration
-------------------------------------------------+-------------------------

Comment (by SergeyBiryukov):

 > `if ( ! empty( $output ) && $this->has_items() )`

 It's not quite clear why this check doesn't use the `$has_items` static
 variable declared above, while the next check does use the variable:

 > `if ( ( 'spam' === $comment_status || 'trash' === $comment_status ) &&
 current_user_can( 'moderate_comments' ) && $has_items ) {`

 If that's intentional, it should be documented.

 It's also worth noting that `class-wp-posts-list-table.php` and `class-wp-
 ms-sites-list-table.php` don't check `$this->has_items()`, just `! empty(
 $output )`. Would be nice to bring some consistency here.

-- 
Ticket URL: <https://core.trac.wordpress.org/ticket/40188#comment:23>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list