Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/wp-admin/includes/class-wp-comments-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ public function prepare_items() {
'number' => $number,
'post_id' => $post_id,
'type' => $comment_type,
'type__not_in' => array( 'note' ),
'orderby' => $orderby,
'order' => $order,
'post_type' => $post_type,
Expand Down
28 changes: 22 additions & 6 deletions tests/phpunit/tests/admin/wpCommentsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,30 +218,46 @@ public function test_get_views_should_return_views_by_default() {
* Verify that the comments table never shows the note comment_type.
*
* @ticket 64198
* @ticket 64474
*
* @dataProvider data_comment_type
*
* @param string $comment_type The comment_type parameter value to test.
*/
public function test_comments_list_table_does_not_show_note_comment_type() {
$post_id = self::factory()->post->create();
$note_id = self::factory()->comment->create(
public function test_comments_list_table_does_not_show_note_comment_type( string $comment_type ) {
$post_id = self::factory()->post->create();
self::factory()->comment->create(
array(
'comment_post_ID' => $post_id,
'comment_content' => 'This is a note.',
'comment_type' => 'note',
'comment_approved' => '1',
)
);
$comment_id = self::factory()->comment->create(
$comment_id = self::factory()->comment->create(
array(
'comment_post_ID' => $post_id,
'comment_content' => 'This is a regular comment.',
'comment_type' => '',
'comment_approved' => '1',
)
);
// Request the note comment type.
$_REQUEST['comment_type'] = 'note';
$_REQUEST['comment_type'] = $comment_type;
$this->table->prepare_items();
$items = $this->table->items;
$this->assertCount( 1, $items );
$this->assertEquals( $comment_id, $items[0]->comment_ID );
}

/**
* Data provider for test_comments_list_table_does_not_show_note_comment_type().
*
* @return array<string, string[]>
*/
public function data_comment_type(): array {
return array(
'note type explicitly requested' => array( 'note' ),
'all type requested' => array( 'all' ),
);
}
}
Loading