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

Cannot fetch comments #53

Closed kwiat1990 closed 3 years ago

kwiat1990 commented 3 years ago

Hi, after updating the comments plugin (v1.0.1) and the Strapi (v.3.6.2) I noticed that I can't fetch any existing comments using the standard endpoints and the response look like below:

  "statusCode": 400,
  "error": "Bad Request",
  "message": "Your filters contain a field 'removed' that doesn't appear on your model definition nor its relations"
}

It doesn't matter how I call the endpoint (fetch request, in the browser's URL bar or in Postman) I still get the very same error. At the same time I see that the comment are there (related field on article, I tried to fetch comments for, have all of them). Funny enough, fetching all comments with comments/moderation/all does work.

I haven't done anything to the code itself, besides mentioned updates, and my config looks like in the documentation.

kwiat1990 commented 3 years ago

The fast solution was to take a look at the last release and then I saw this change. As a quick fix I added the same code to my comment model. After that all endpoints are working again. I assume it should be somehow target in the new release/hotfix or mentioned in the documentation.

cyp3rius commented 3 years ago

Good spot @kwiat1990 but that occurs only if you’ve got comment model in extensions, so core one is being overwritten.

We will provide it as a Migration Guide 1.0.0 -> 1.0.1 in documentation.

kwiat1990 commented 3 years ago

Does it mean that it's not needed anymore to define the model by hand? I can remember it was required in the past or am I wrong?

cyp3rius commented 3 years ago

It’s required for content types you want to define comments like: page, post etc.

Modification of plugin built-in comment model is not required anymore. We have fixed that issue some time ago.

kwiat1990 commented 3 years ago

Thanks, it's really good to know. If I were aware of this, then I wouldn't encounter the problem in the first place.