-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
made changes for comment rest api to support with block commenting #7488
base: trunk
Are you sure you want to change the base?
made changes for comment rest api to support with block commenting #7488
Conversation
Hi @rishishah-multidots! 👋 Thank you for your contribution to WordPress! 💖 It looks like this is your first pull request to No one monitors this repository for new pull requests. Pull requests must be attached to a Trac ticket to be considered for inclusion in WordPress Core. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. Pull requests are never merged on GitHub. The WordPress codebase continues to be managed through the SVN repository that this GitHub repository mirrors. Please feel free to open pull requests to work on any contribution you are making. More information about how GitHub pull requests can be used to contribute to WordPress can be found in the Core Handbook. Please include automated tests. Including tests in your pull request is one way to help your patch be considered faster. To learn about WordPress' test suites, visit the Automated Testing page in the handbook. If you have not had a chance, please review the Contribute with Code page in the WordPress Core Handbook. The Developer Hub also documents the various coding standards that are followed:
Thank you, |
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the Core Committers: Use this line as a base for the props when committing in SVN:
To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
Trac Ticket MissingThis pull request is missing a link to a Trac ticket. For a contribution to be considered, there must be a corresponding ticket in Trac. To attach a pull request to a Trac ticket, please include the ticket's full URL in your pull request description. More information about contributing to WordPress on GitHub can be found in the Core Handbook. |
Test using WordPress PlaygroundThe changes in this pull request can previewed and tested using a WordPress Playground instance. WordPress Playground is an experimental project that creates a full WordPress instance entirely within the browser. Some things to be aware of
For more details about these limitations and more, check out the Limitations page in the WordPress Playground documentation. |
Modify add comment test case to allow custom comment type
made changes for add comment test case for comment rest API.
add comment test cases changes for allow custom comment type
@TimothyBJacobs do these changes look good to you? Thanks. :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've added a comment inline re: allowing the submission of unsupported comment types.
If block comments are to be a thing, then they should build upon the existing comment
rather than be a new type.
// Do not allow comments to be created with a non-default type. | ||
if ( ! empty( $request['type'] ) && 'comment' !== $request['type'] ) { | ||
return new WP_Error( | ||
'rest_invalid_comment_type', | ||
__( 'Cannot create a comment with that type.' ), | ||
array( 'status' => 400 ) | ||
); | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this should be removed.
As the change to the unit tests show, it allows the addition of comment types to the database that WordPress is unable to support. This is problematic for a number of reasons, primarily because it fills the databse with junk, secondly because plugins may not expect the data and throw a fatal error as a result.
Ignore this part of my comment, I made an assumption about what was meant by block comments that was incorrect. For the block comments being introduced, then the new comment type should be registered. |
Pull Request Description
Title: Modify Comment REST API to Support Block Comments
Overview: This pull request enhances the WordPress Comment REST API by adding support for block comments. This functionality aims to improve rest API add comment functionality to support the block commenting feature.
Changes Made:
Why This Matters:
wp_insert_comment
comment_approved
as1
.Related Tickets:
Ticket #60622: Discussion on block comments feature.