Fix type of parent ID when creating a response to a parent comment#2195
Fix type of parent ID when creating a response to a parent comment#2195mike-lei wants to merge 1 commit intowp-graphql:developfrom mike-lei:comment-parent-id-type
Conversation
|
Code Climate has analyzed commit ce3db83 and detected 0 issues on this pull request. View more on Code Climate. |
|
+1 Having an issue with trying to post a comment as a reply to a parent comment. I'm trying to pass the comment ID (string) as the parent, so the current comment I'm trying to submit will be set as a "reply" instead of its own comment but it isn't working.... |
|
This is working locally for me, but we should probably add a wpunit test for creating child comments. |
|
On further review (#997), this seems to be the wrong approach. Rather, we need to (plugin wide) either indicate that most where args expect a |
|
closing in favor of #2328 |
What does this implement/fix? Explain your changes.
I was trying to create a comment under another comment (i.e. reply to a comment), but it looks like setting
parentincreateComment's input field does not work at all, the comment is posted directly under the post, not a response to another comment.Changed the type of
parenttoIntand the issue was gone.According to https://developer.wordpress.org/reference/functions/wp_new_comment/, when creating a new comment with parent ID,
comment_parentfield should be integer, not ID/string. Currently we're takingparentargument as ID.Does this close any currently open issues?
No
Any relevant logs, error output, GraphiQL screenshots, etc?
There's no error message for this bug.
The following command would post the comment directly under post 3538 (
parentdoes not work):The following command would post a response under comment "Y29tbWVudDoxMDQ1" / 1045 after I changed type of
parenttoInt:Any other comments?
First time creating a PR to an open source project, please let me know if I need to change anything, thanks!
Where has this been tested?
Operating System: Windows 11
WordPress Version: 5.8.2