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

Can relate only one content type #93

Closed ChiKaLiO closed 2 years ago

ChiKaLiO commented 2 years ago

I just added the plugin and everything seemed fine until i tried to post a comment..

{
    "statusCode": 400,
    "error": "Bad Request",
    "message": "{\"name\":\"Strapi:Plugin:Comments\",\"status\":400,\"message\":\"Can relate only one content type\"}"
}

the post body:

{
    "authorId": "2",
    "authorName": "Joe Doe",
    "authorEmail": "jdoe@sample.com",
    "content": "My sample response",
}

plugin.js:

module.exports = {
    comments: {
    enableUsers: true,
    relatedContentTypes: {
      forum_austerities: {
        uuid: 'application::forum-austerity.forum-austerity',
        contentManager: true,
        __contentType: '',
        key: 'title',
        value: 'id',
      }
    }
  },
}

model:

....
    "comments": {
      "plugin": "comments",
      "collection": "comment",
      "via": "related"
    }
cyp3rius commented 2 years ago

@ChiKaLiO are you using v3 or v4 of Strapi?

ChiKaLiO commented 2 years ago

@ChiKaLiO are you using v3 or v4 of Strapi?

V3, i'm using mongo

cyp3rius commented 2 years ago

@ChiKaLiO I've checked your case and it seems that you didn't done the POST properly:

    "related": [{
        "refId": 1,
        "ref": "forum-austerity",
        "field": "comments"
    }] 

Simply the related is missing. See Readme.md