wp-graphql / wp-graphql-woocommerce

Add WooCommerce support and functionality to your WPGraphQL server
https://woographql.com
GNU General Public License v3.0
639 stars 129 forks source link

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

Open shyqerigashi opened 2 years ago

shyqerigashi commented 2 years ago

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

@jasonbahl @renatonascalves @jacobarriola @kidunot89

kidunot89 commented 2 years ago

@shyqerigashi Not sure this is WooGraphQL issue.

AVert commented 1 year ago

Same problem with woocommerce

AVert commented 1 year ago

@shyqerigashi Not sure this is WooGraphQL issue.

please give example where this not return null

shyqerigashi commented 1 year ago

@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" }