Skip to content
Closed
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
6 changes: 5 additions & 1 deletion src/wp-admin/includes/class-wp-comments-list-table.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,11 @@ public function prepare_items() {
$comment_status = 'all';
}

$comment_type = ! empty( $_REQUEST['comment_type'] ) ? $_REQUEST['comment_type'] : '';
$comment_type = '';

if ( ! empty( $_REQUEST['comment_type'] ) && 'note' !== $_REQUEST['comment_type'] ) {
$comment_type = $_REQUEST['comment_type'];
}

$search = ( isset( $_REQUEST['s'] ) ) ? $_REQUEST['s'] : '';

Expand Down
31 changes: 31 additions & 0 deletions tests/phpunit/tests/admin/wpCommentsListTable.php
Original file line number Diff line number Diff line change
Expand Up @@ -213,4 +213,35 @@ public function test_get_views_should_return_views_by_default() {
);
$this->assertSame( $expected, $this->table->get_views() );
}

/**
* Verify that the comments table never shows the note comment_type.
*
* @ticket 64198
*/
public function test_comments_list_table_does_not_show_note_comment_type() {
$post_id = self::factory()->post->create();
$note_id = 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(
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';
$this->table->prepare_items();
$items = $this->table->items;
$this->assertCount( 1, $items );
$this->assertEquals( $comment_id, $items[0]->comment_ID );
}
}
Loading