Skip to content

Commit c7cf013

Browse files
committed
Notes: Ignore flood checks
1 parent f12a701 commit c7cf013

2 files changed

Lines changed: 5 additions & 19 deletions

File tree

lib/compat/wordpress-6.9/block-comments.php

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -115,21 +115,3 @@ function gutenberg_filter_comment_count_query_exclude_block_comments( $query ) {
115115
return $query;
116116
}
117117
add_filter( 'query', 'gutenberg_filter_comment_count_query_exclude_block_comments' );
118-
119-
/**
120-
* Allows duplicate block comment.
121-
*
122-
* @since 6.9.0
123-
*
124-
* @param int $dupe_id The duplicate comment ID.
125-
* @param array $commentdata The comment data.
126-
*
127-
* @return int ID of the comment identified as a duplicate.
128-
*/
129-
function gutenberg_allow_duplicate_note_resolution( $dupe_id, $commentdata ) {
130-
if ( isset( $commentdata['comment_type'] ) && 'note' === $commentdata['comment_type'] ) {
131-
return false;
132-
}
133-
return $dupe_id;
134-
}
135-
add_filter( 'duplicate_comment_id', 'gutenberg_allow_duplicate_note_resolution', 10, 2 );

lib/compat/wordpress-6.9/class-gutenberg-rest-comment-controller-6-9.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -378,7 +378,11 @@ public function create_item( $request ) {
378378
);
379379
}
380380

381-
$prepared_comment['comment_approved'] = wp_allow_comment( $prepared_comment, true );
381+
// Don't check for duplicates or flooding for notes.
382+
$prepared_comment['comment_approved'] =
383+
'note' === $prepared_comment['comment_type'] ?
384+
'1' :
385+
wp_allow_comment( $prepared_comment, true );
382386

383387
if ( is_wp_error( $prepared_comment['comment_approved'] ) ) {
384388
$error_code = $prepared_comment['comment_approved']->get_error_code();

0 commit comments

Comments
 (0)