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

WordPress Trac noreply at wordpress.org
Sat Sep 30 17:21:30 UTC 2017


#40188: Filter button should not appear when no comments are available in list
-------------------------------------------------+-------------------------
 Reporter:  swissspidy                           |       Owner:  Jim_Panse
     Type:  defect (bug)                         |      Status:  assigned
 Priority:  normal                               |   Milestone:  Awaiting
Component:  Comments                             |  Review
 Severity:  normal                               |     Version:
 Keywords:  good-first-bug has-patch has-unit-   |  Resolution:
  tests                                          |     Focuses:  ui,
                                                 |  administration
-------------------------------------------------+-------------------------
Changes (by birgire):

 * keywords:  good-first-bug has-patch => good-first-bug has-patch has-unit-
     tests


Comment:

 In [attachment:40188.7.patch] we introduce a new
 {{{comment_status_dropdown()}}} method of {{{WP_Comments_List_Table}}}, to
 make it more readable, in a similar way as the {{{categories_dropdown()}}}
 method was introduced in {{{WP_Posts_List_Table}}}.

 I like the idea to remove the table nav for no comments in
 {{{WP_List_Table}}}, like:


 {{{
 protected function display_tablenav( $which ) {
     if( ! $this->has_items() ) {
         return;
     }
     ...

 }}}

 but it sounded out of scope according to the current ticket title, so I
 did a smaller step instead, in  {{{WP_Comments_List_Table}}} only.

 Added a test, based on the ones in #38341

  - {{{test_filter_button_should_not_be_shown_if_there_are_no_comments()}}}

 and then two more:

 - {{{test_filter_button_should_be_shown_if_there_are_comments()}}}
 -
 {{{test_filter_comment_status_dropdown_should_be_shown_if_there_are_comments()}}}

 It was a real headache to make the last two work as expected, because
 after lot of digging I found out that other tests where modifying the
 {{{$_REQUEST}}} global and that was being picket up here by our
 {{{WP_Comments_List_Table}}} instance. That meant the offset ended up as
 120 and no comments where returned ;-)

 So I will create a new ticket to fix these older tests, so currently our
 tests are blocked by that.

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


More information about the wp-trac mailing list