Skip to content
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

Post Comments not returning commentedOn value as object but null instead #561

Open
shyqerigashi opened this issue Oct 3, 2021 · 4 comments
Labels
bug Something isn't working

Comments

@shyqerigashi
Copy link

shyqerigashi commented Oct 3, 2021

Describe the bug
I'm implementing wp comments with wp-graphql and they did work perfectly until I installed wp-graphql-woocommerce, what is not returning is commentedOn value it always returns null.

To Reproduce
Execude Query:

query GetForumBySlug($slug: String!) {
forumBy(slug: $slug) {
...ForumSingleItem
__typename
}
}
fragment ForumSingleItem on Forum {
id
databaseId
title
date
content
slug
author {
node {
name
__typename
}
__typename
}
comments(where: {parent: null, order: ASC, orderby: COMMENT_DATE}) {
nodes {
...Comment
}
}
}
fragment Comment on Comment {
id
content
databaseId
date
approved
author {
node {
databaseId
__typename
}
}
commentedOn {
node {
id
databaseId
slug
... on Forum {
id
databaseId
slug
forumId
}
... on Lesson {
id
databaseId
slug
lessonId
}
... on Course {
id
databaseId
slug
courseId
}
}
}
commentOptions {
author
__typename
}
}

Expected behavior
This is how it supposed to return data

{
"data": {
"forumBy": {
"id": "cG9zdDoyODc=",
"databaseId": 287,
"title": "qysh me ba pagesen e rrogave?",
"date": "2021-06-02T00:10:52",
"content": "

dskjfsjdkfjnskdf dsfsdf sdkfjsd fksdf ksdf

\n",
"slug": "qysh-me-ba-pagesen-e-rrogave",
"author": {
"node": {
"name": "malukiSuperAdmin",
"__typename": "User"
},
"__typename": "NodeWithAuthorToUserConnectionEdge"
},
"comments": {
"nodes": [
{
"id": "Y29tbWVudDoyMDY=",
"content": "

go to top and do something

\n",
"databaseId": 206,
"date": "2021-06-01 22:12:10",
"approved": true,
"author": {
"node": null
},
"commentedOn": {
"node": {
"id": "cG9zdDoyODc=",
"databaseId": 287,
"slug": "qysh-me-ba-pagesen-e-rrogave",
"forumId": 287
}
}
},
{
"id": "Y29tbWVudDoyMDg=",
"content": "

test

\n",
"databaseId": 208,
"date": "2021-06-01 22:13:00",
"approved": true,
"author": {
"node": null
},
"commentedOn": {
"node": {
"id": "cG9zdDoyODc=",
"databaseId": 287,
"slug": "qysh-me-ba-pagesen-e-rrogave",
"forumId": 287
}
}
}
]
},
"__typename": "Forum"
}
},
"extensions": {
"debug": []
}
}

Screenshots
How it is supposed to work (without wp-graphql-woocomerce plugin activated)
image

How it is working (with wp-graphql-woocomerce plugin activated)
image

Plugin Versions

  • WooGraphQL Version: 0.10.3
  • WPGraphQL Version: 1.6.4
  • WordPress Version: 5.8.1
  • WooCommerce Version: 5.6.0

@jasonbahl @renatonascalves @jacobarriola @kidunot89

@kidunot89 kidunot89 added the bug Something isn't working label Oct 6, 2021
@kidunot89
Copy link
Member

@shyqerigashi Not sure this is WooGraphQL issue.

@AVert
Copy link
Contributor

AVert commented Feb 5, 2023

Same problem with woocommerce

@AVert
Copy link
Contributor

AVert commented Feb 5, 2023

@shyqerigashi Not sure this is WooGraphQL issue.

please give example where this not return null

@shyqerigashi
Copy link
Author

@AVert here is how it should look like
{ "id": "cG9zdDoxNDg4", "databaseId": 1488, "title": "TITLE....", "date": "2022-01-30T19:08:31", "content": "CONTENT.....", "slug": "eksporti-dhe-tvsh", "author": { "node": { "name": "NAME", "__typename": "User" }, "__typename": "NodeWithAuthorToUserConnectionEdge" }, "comments": { "nodes": [ { "id": "Y29tbWVudDozODc=", "content": "CONTENT.......", "databaseId": 387, "date": "2022-01-30 17:14:53", "approved": true, "author": { "node": { "databaseId": 7, "__typename": "User" }, "__typename": "CommentToCommenterConnectionEdge" }, "commentedPost": { "databaseId": 1488, "slug": "eksporti-dhe-tvsh", "__typename": "CustomCommentedPostOption" }, "commentOptions": { "author": null, "correctAnswer": null, "__typename": "Comment_Commentoptions" }, "replies": { "nodes": [], "__typename": "CommentToCommentConnection" }, "__typename": "Comment" } ], "__typename": "ForumToCommentConnection" }, "forumOptions": { "files": null, "__typename": "Forum_Forumoptions" }, "__typename": "Forum" }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants