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

Removal of referenced content leads to the admin interface not loading #104

Closed Raffy27 closed 2 years ago

Raffy27 commented 2 years ago

Using GraphQL, Strapi v4.0.7, strapi-plugin-comments 2.0.0. When content bound to comments is removed, the GraphQL mutation for adding a new comment to said content still succeeds, but renders the relevant page of the admin interface unusable.

Steps to reproduce

Add a Content-Type of api::post.post (Post), having a Rich Text field named content. Configuration is as follows:

module.exports = ({ env }) => ({
  comments: {
      badWords: false,
      approvalFlow: ['api::post.post'],
      entryLabel: {
          'api::post.post': ['content'],
      },
      reportReasons: {
          'MY_CUSTOM_REASON': 'MY_CUSTOM_REASON',
      },
      gql: { 
        auth: false
      },
  },
});

Add a Post entry of id: 1 (for testing), then remove it. Proceed with the mutation

mutation createComment {
  createComment(
    input: {
      relation: "api::post.post:1"
      content: "Hello World!"
      author: { id: "12345678", name: "John Wick", email: "test@test.pl" }
    }
  ) {
    id
  }
}

This should return

{
  "data": {
    "createComment": {
      "id": 2
    }
  }
}

Now, trying to access Admin >> Comments (/admin/plugins/comments/discover) yields an empty page along with the bundled errors

image

Expected behavior

Given the fact that the referenced entity does not exist, the mutation should fail, and the Admin interface should still load.

cyp3rius commented 2 years ago

Issue has been fixed in v2.0.1.