Closed cyp3rius closed 3 years ago
Is there any ETA for this?
@SalahAdDin first draft PR by @Kronos66 is already here, expecting 1-2 weeks to release under new version.
Hi @cyp3rius, any progress on this one? When we could expect this feature to be released?
@kwiat1990 @SalahAdDin -> strapi-plugin-comments@1.0.2-beta.1
has been published recently and contains basic support for GQL. All feedback and testing welcome :)
Hello
I have strapi project with GraphQL enabled and after installing strapi-plugin-comments I receive error:
"GraphQLError: Syntax Error: Expected Name, found "}"."
I'm using strapi 3.6.6 and strapi-plugin-comments: ^1.0.2-beta.1
Any idea what I'm doing wrong there :( ?
This is a clean project without any custom modifications
Hi @pogosoftware I checked your error and the reason why you got this is not configured a comments plugin :(. When I create GQL schema I use config to add to schema relation content types:
plugins.comments.relatedContentTypes
That configuration should contain an object with configuration content types in relation to the comments plugin. I forgot to add documentation to readme about this, but if you create this configuration everything should start working,. Example configuration:
comments: {
relatedContentTypes: {
pages: {
contentManager: true,
isSingle: true,
key: 'title',
value: 'id'
},
test: {
contentManager: false
}
},
},
@Kronos66 thanks! It's working now.
But I found 2 other issues.
First, if you block some comments then GraphQL return it. It would be nice if blocked comments and threads will be automatically filtered out from GraphQL query results.
Second, i tried to filter block comments using this query:
query GetArticles {
articles(where: { comments: { blocked: false}}) {
title
comments {
id
content
blocked
}
}
But i received and error:
"select distinct `articles`.* from `articles` left join `main`.`comments` as `comments_1` on `comments_1`.`related` = `articles`.`id` where `comments_1`.`blocked` = false and (`articles`.`published_at` is not null) limit 100 - SQLITE_ERROR: no such column: comments_1.related"
@pogosoftware thanks for the feedback!
I checked that problem and I think your query won't work correctly because you tried to filter on polymorphic relation where strapi have a problem with this relation type https://github.com/strapi/strapi/issues/4254
I prepared a special query
for this can't use built-in methods.
Please use our query methods:
findAllInHierarchy(relation: Relation!, where: JSON): [CommentsInHierarchy]!
findAllFlat(relation: Relation!, where: JSON): [Comment]!
findAll(related: Relation, entity: ID, where: JSON): CommentsPagination!
findOne(id: ID!): CommentsFindOne
config: CommentsConfig
contentTypeName(contentType: String!): [CommentsContentType]!
Hi @pogosoftware I checked your error and the reason why you got this is not configured a comments plugin :(. When I create GQL schema I use config to add to schema relation content types:
plugins.comments.relatedContentTypes
That configuration should contain an object with configuration content types in relation to the comments plugin. I forgot to add documentation to readme about this, but if you create this configuration everything should start working,. Example configuration:
comments: { relatedContentTypes: { pages: { contentManager: true, isSingle: true, key: 'title', value: 'id' }, test: { contentManager: false } }, },
Please where do I find this file.. location
@sheddy123 I've created a plugin.js file inside the config directory with this content.
module.exports = ({ env }) => ({
comments: {
relatedContentTypes: {
pages: {
contentManager: true,
isSingle: true,
key: 'title',
value: 'id'
},
test: {
contentManager: false
}
},
},
});
That works for me. If you need more information abot that please go to the official documentation
@sheddy123 I've created a plugin.js file inside the config directory with this content.
module.exports = ({ env }) => ({ comments: { relatedContentTypes: { pages: { contentManager: true, isSingle: true, key: 'title', value: 'id' }, test: { contentManager: false } }, }, });
That works for me. If you need more information abot that please go to the official documentation
I couldn't figure that as well. Trying to use REST Api rather. But calling the endpoint "http://localhost:1337/comments/article:1" I get this as my response { "statusCode": 403, "error": "Forbidden", "message": "Forbidden" } Please help on how to resolve this.. and for path specification I would be glad if that's included
@sheddy123 have you turned on endpoints in the settings? By default they are not exposed publicly.
@sheddy123 have you turned on endpoints in the settings? By default they are not exposed publicly.
@cyp3rius I am new to this... so could you be more specific... The endpoint have been turned in the roles section(public) on the UI... so for the Comments part under permission, findall, findone, and put have been checked, but still get same error. When I click on findone it displays "/comments/moderation/single/:id"... how should the url look like. I have an articles collection type and want to do a [GET and POST] http://localhost:1337/comments/article:1 for GET but returns { "statusCode": 403, "error": "Forbidden", "message": "Forbidden" } using POSTMAN... please I need more clarification on this thanks
@sheddy123 I've created a plugin.js file inside the config directory with this content.
module.exports = ({ env }) => ({ comments: { relatedContentTypes: { pages: { contentManager: true, isSingle: true, key: 'title', value: 'id' }, test: { contentManager: false } }, }, });
That works for me. If you need more information abot that please go to the official documentation
I use name plugins.js instead of plugin.js and worked.
@sheddy123 I've created a plugin.js file inside the config directory with this content.
module.exports = ({ env }) => ({ comments: { relatedContentTypes: { pages: { contentManager: true, isSingle: true, key: 'title', value: 'id' }, test: { contentManager: false } }, }, });
That works for me. If you need more information abot that please go to the official documentation
I use name plugins.js instead of plugin.js and worked.
actually, the correct name is plugins.js
.
Feature has been released as v1.0.2
@cyp3rius So, it means it is full operative now, right?
References: #13, #24