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
405 stars 63 forks source link

Get comments endpoint doesn't filter by author #204

Closed ubaranzorlu closed 1 year ago

ubaranzorlu commented 1 year ago

Summary

I expect get comments endpoint to be able to filter author or author.id property according to Strapi Docs. However, it throws an error.

Steps to reproduce

  1. Make a comment
  2. Send GET request to "/api/comments/{collection}:{id}/flat?pagination[pageSize]=5&pagination[page]=1&pagination[withCount]=true&filters[author][$eq]=58&sort=createdAt:desc"

Expected results

Return comments sent by the author specified (58).

Actual results

{
  "data": null,
  "error": {
    "status": 500,
    "name": "InternalServerError",
    "message": "Internal Server Error"
  }
}

I have tried other filter queries as well with no luck.

cyp3rius commented 1 year ago

Hello @ubaranzorlu,

as the plugin support both non-Strapi + Strapi users the filtering should be done like below.

non-Strapi users:

Strapi users:

ubaranzorlu commented 1 year ago

Thanks for your response, it worked. Adding this info to the Readme might be helpful for others.