WordPress.org

Make WordPress Core

Opened 4 months ago

Closed 3 months ago

Last modified 3 months ago

#40975 closed defect (bug) (fixed)

'Empty Spam' and 'Empty Trash' comment buttons not displayed on mobile

Reported by: SergeyBiryukov Owned by: SergeyBiryukov
Milestone: 4.8.1 Priority: normal
Severity: normal Version: 4.8
Component: Comments Keywords: has-patch needs-testing
Focuses: administration Cc:

Description

Since [26134], top navigation for list tables is not displayed on mobile, which means that 'Empty Spam' and 'Empty Trash' buttons were only displayed in bottom navigation.

Since [40297], these buttons are not displayed in bottom navigation either (on both mobile and desktop) if there's only one page of comments in Spam/Trash, because $this->extra_items is empty, $this->items ends up empty too in ::display(), so $this->has_items() returns false.

The lack of the button also causes the %s items string to overlap with the search bar, see the screenshot.

If there are two or more pages of comments in Spam/Trash, the buttons are displayed as expected.

Attachments (2)

40975.PNG (4.1 KB) - added by SergeyBiryukov 4 months ago.
40975.patch (1.1 KB) - added by SergeyBiryukov 4 months ago.

Download all attachments as: .zip

Change History (8)

@SergeyBiryukov
4 months ago

#1 @SergeyBiryukov
4 months ago

  • Keywords has-patch added

40975.patch fixes the issue by saving $this->has_items() to a static variable, so that the value is consistent between top and bottom navigation.

Other screens appear to be unaffected, as they don't reset $this->items before displaying bottom navigation.

#2 @jbpaul17
3 months ago

  • Keywords needs-testing added

This ticket was mentioned in Slack in #core by jeffpaul. View the logs.


3 months ago

#4 @jbpaul17
3 months ago

  • Owner set to SergeyBiryukov
  • Status changed from new to assigned

#5 @SergeyBiryukov
3 months ago

  • Resolution set to fixed
  • Status changed from assigned to closed

In 41022:

Comments: In WP_Comments_List_Table::extra_tablenav(), save the state of ::has_items() to a static variable, so that the value is consistent between top and bottom navigation.

This prevents "Empty Spam" and "Empty Trash" buttons from disappearing if there's only one page of comments in Spam/Trash.

Fixes #40975.

#6 @SergeyBiryukov
3 months ago

In 41023:

Comments: In WP_Comments_List_Table::extra_tablenav(), save the state of ::has_items() to a static variable, so that the value is consistent between top and bottom navigation.

This prevents "Empty Spam" and "Empty Trash" buttons from disappearing if there's only one page of comments in Spam/Trash.

Fixes #40975.

Merges [41022] to the 4.8 branch.

Note: See TracTickets for help on using tickets.