Skip to content

Commit

Permalink
Merge pull request #85 from rishishah-multidots/try/inline-block-comm…
Browse files Browse the repository at this point in the history
…enting

Remove 6.7 rest API and other minor fixes
  • Loading branch information
poojabhimani12 authored Oct 23, 2024
2 parents 5781530 + 127228b commit ca54345
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 42 deletions.
3 changes: 1 addition & 2 deletions backport-changelog/6.8/7488.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
https://github.com/WordPress/wordpress-develop/pull/7488

* https://github.com/WordPress/gutenberg/pull/60622
* https://github.com/WordPress/gutenberg/pull/65181
* https://github.com/WordPress/gutenberg/pull/60622
40 changes: 0 additions & 40 deletions lib/compat/wordpress-6.7/rest-api.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,46 +115,6 @@ function gutenberg_override_default_rest_server() {
}
add_filter( 'wp_rest_server_class', 'gutenberg_override_default_rest_server', 1 );

/**
* Updates the comment type in the REST API for WordPress version 6.7.
*
* This function is used as a filter callback for the 'rest_pre_insert_comment' hook.
* It checks if the 'comment_type' parameter is set to 'block_comment' in the REST API request,
* and if so, updates the 'comment_type' and 'comment_approved' properties of the prepared comment.
*
* @param array $prepared_comment The prepared comment data.
* @param WP_REST_Request $request The REST API request object.
* @return array The updated prepared comment data.
*/
if ( ! function_exists( 'update_comment_type_in_rest_api_6_7' ) && gutenberg_is_experiment_enabled( 'gutenberg-block-comment' ) ) {
function update_comment_type_in_rest_api_6_7( $prepared_comment, $request ) {
if ( ! empty( $request['comment_type'] ) && 'block_comment' === $request['comment_type'] ) {
$prepared_comment['comment_type'] = $request['comment_type'];
$prepared_comment['comment_approved'] = $request['comment_approved'];
}

return $prepared_comment;
}
add_filter( 'rest_pre_insert_comment', 'update_comment_type_in_rest_api_6_7', 10, 2 );
}

/**
* Updates the comment type for avatars in the WordPress REST API.
*
* This function adds the 'block_comment' type to the list of comment types
* for which avatars should be retrieved in the WordPress REST API.
*
* @param array $comment_type The array of comment types.
* @return array The updated array of comment types.
*/
if ( ! function_exists( 'update_get_avatar_comment_type' ) && gutenberg_is_experiment_enabled( 'gutenberg-block-comment' ) ) {
function update_get_avatar_comment_type( $comment_type ) {
$comment_type[] = 'block_comment';
return $comment_type;
}
add_filter( 'get_avatar_comment_types', 'update_get_avatar_comment_type' );
}

/**
* Filters the arguments for registering a wp_global_styles post type.
* Note when syncing to Core: the capabilities should be updates for `wp_global_styles` in the wp-includes/post.php.
Expand Down

0 comments on commit ca54345

Please sign in to comment.