VirtusLab-Open-Source / strapi-plugin-comments

A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.
MIT License
414 stars 65 forks source link

FindAllInHierarachy GraphQL where param does not work #90

Closed wbs-servicedesk closed 2 years ago

wbs-servicedesk commented 3 years ago

There is an issue with the schema.graphql.js file for the Query Resolver findAllInHierarchy.

You have it currently like this:

return strapi.plugins.comments.services.comments.findAllInHierarchy({ relation, **where**, dropBlockedThreads: true, });

When it should be something like this:

return strapi.plugins.comments.services.comments.findAllInHierarchy({ relation, **query: where**, dropBlockedThreads: true, });

The reason being is that your service

async findAllInHierarchy ({ relation, query, startingFromId = null, dropBlockedThreads = false, isAdmin = false, }) { const entities = await this.findAllFlat(relation, query, isAdmin); return buildNestedStructure(entities, startingFromId, 'threadOf', dropBlockedThreads, false, this.isMongoDB()); },

does not have any where param. I assume that you want to use the where as the query, so the change above should fix the issue. Otherwise where will be undefined when using a graphQL call.

PritamSangani commented 3 years ago

@wbs-servicedesk haha I was about to come and create the same issue. I was thinking of opening a PR to fix the issue unless you want to.

PritamSangani commented 3 years ago

It looks like the same fix needs to be made in the findAll resolver as well

wbs-servicedesk commented 3 years ago

@PritamSangani Please go ahead and do the pull request, I am currently at work so I won't be able to do it anytime soon. Yeah, good catch!

cyp3rius commented 2 years ago

@PritamSangani @wbs-servicedesk are you still interested in fixing this issue for v3?

cyp3rius commented 2 years ago

Closing, we won't provide this fix for v3. The 2.x version dedicated for Strapi v4 got it implemented by default.