All Projects → VirtusLab → Strapi Plugin Comments

VirtusLab / Strapi Plugin Comments

Licence: mit
A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Strapi Plugin Comments

Strapi
🚀 Open source Node.js Headless CMS to easily build customisable APIs
Stars: ✭ 41,786 (+30179.71%)
Mutual labels:  api, rest, customizable
Psx
PHP REST API Framework
Stars: ✭ 108 (-21.74%)
Mutual labels:  api, rest
Vue Api Query
💎 Elegant and simple way to build requests for REST API
Stars: ✭ 1,528 (+1007.25%)
Mutual labels:  api, rest
Poloniex Api Node
Poloniex API client for REST and WebSocket API
Stars: ✭ 138 (+0%)
Mutual labels:  api, rest
Invoice As A Service
💰 Simple invoicing service (REST API): from JSON to PDF
Stars: ✭ 106 (-23.19%)
Mutual labels:  api, rest
Airdcpp Webclient
Communal peer-to-peer file sharing application for file servers/NAS devices
Stars: ✭ 106 (-23.19%)
Mutual labels:  api, rest
Golang Gin Realworld Example App
Exemplary real world application built with Golang + Gin
Stars: ✭ 1,780 (+1189.86%)
Mutual labels:  api, rest
Com api
API framework for Joomla
Stars: ✭ 102 (-26.09%)
Mutual labels:  api, rest
Rest Api Fuzz Testing
REST API Fuzz Testing (RAFT): Source code for self-hosted service developed for Azure, including the API, orchestration engine, and default set of security tools (including MSR's RESTler), that enables developers to embed security tooling into their CI/CD workflows
Stars: ✭ 119 (-13.77%)
Mutual labels:  api, rest
Narration
The Narration PHP Framework - Empowering everyone to build reliable and loosely coupled web apps.
Stars: ✭ 119 (-13.77%)
Mutual labels:  api, rest
Zoomhub
Share and view high-resolution images effortlessly
Stars: ✭ 122 (-11.59%)
Mutual labels:  api, rest
Flickr Sdk
Almost certainly the best Flickr API client in the world for node and the browser
Stars: ✭ 104 (-24.64%)
Mutual labels:  api, rest
Denonavr
Automation Library for Denon AVR receivers.
Stars: ✭ 104 (-24.64%)
Mutual labels:  api, rest
Tcases
A model-based test case generator
Stars: ✭ 103 (-25.36%)
Mutual labels:  api, rest
Aping
angular module to get and display data by adding html-attributes
Stars: ✭ 135 (-2.17%)
Mutual labels:  api, rest
Json Serverless
Transform a JSON file into a serverless REST API in AWS cloud
Stars: ✭ 108 (-21.74%)
Mutual labels:  api, rest
Appy Backend
A user system to bootstrap your app.
Stars: ✭ 96 (-30.43%)
Mutual labels:  api, rest
Swiftagram
A modern Swift wrapper for Instagram Private API.
Stars: ✭ 100 (-27.54%)
Mutual labels:  api, comments
Gandi Live Dns
DynDNS Updater for Gandi LiveDNS REST API
Stars: ✭ 116 (-15.94%)
Mutual labels:  api, rest
Subzero Starter Kit
Starter Kit and tooling for authoring GraphQL/REST API backends with subZero
Stars: ✭ 136 (-1.45%)
Mutual labels:  api, rest

Strapi - Comments plugin

NPM Version Monthly download on NPM CircleCI codecov.io

A plugin for Strapi Headless CMS that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and more.

UI preview

⏳ Installation

(Use yarn to install this plugin within your Strapi project (recommended). Install yarn with these docs.)

yarn add [email protected]

After successful installation you've to build a fresh package that includes plugin UI. To archive that simply use:

yarn build
yarn develop

or just run Strapi in the development mode with --watch-admin option:

yarn develop --watch-admin

The Comments plugin should appear in the Plugins section of Strapi sidebar after you run app again.

Enjoy 🎉

🖐 Requirements

Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under Installation Requirements.

Supported Strapi versions:

  • Strapi v3.3.4 (recently tested)
  • Strapi v3.x

(This plugin may work with the older Strapi versions, but these are not tested nor officially supported at this time.)

We recommend always using the latest version of Strapi to start your new projects.

Features

  • Comments Public API: Elegant, entirely customizable and a fully extensible admin panel.
  • Strapi & generic users: Support for built-in & also generic non-Strapi users that might be the comments authors.
  • Any Content Type relation: Comments can by linked to any of your Content Types by default. Simply, you're controlling it.
  • Moderation Panel: Search & Filter through the bucket with your auditory comments. Manage them by blocking single ones or full threads. All in combined list & hierarchical tree view of threads.
  • Automated Bad Words filtering: By detault end users are not allowed to post abusing comments where bad words have been used.
  • Abuse Reporting & Reviewing: Don't allow inferior language, react to reports from your community

Content Type model relation to Comment

To enable Content Type to work with Comments, you've to add following field to your model *.settings.json:

    "comments": {
      "plugin": "comments",
      "collection": "comment",
      "via": "related"
    }

inside the attributes section like in example below:

    "attributes": {
        ...,
        "comments": {
            "plugin": "comments",
            "collection": "comment",
            "via": "related"
        },
        ...
    },

Public API Comment model

Generic (non Strapi User)

{
    "id": 1,
    "content": "My comment content",
    "blocked": null,
    "blockedThread": true,
    "blockReason": null,
    "points": 1,
    "authorUser": null,
    "authorId": "207ccfdc-94ba-45eb-979c-790f6f49c392",
    "authorName": "Joe Doe",
    "authorEmail": "[email protected]",
    "authorAvatar": null,
    "created_at": "2020-07-14T20:13:01.649Z",
    "updated_at": "2020-07-14T20:13:01.670Z"
}

Strapi User

{
    "id": 1,
    "content": "My comment content",
    "blocked": true,
    "blockedThread": null,
    "blockReason": null,
    "points": null,
    "authorUser": {
        "id": 1,
        "username": "Sample User",
        "email": "[email protected]",
        "provider": "local",
        "confirmed": true,
        "blocked": false,
        "role": 1,
        "created_at": "2020-07-10T08:38:03.157Z",
        "updated_at": "2020-07-10T08:38:03.170Z"
    },
    "authorId": null,
    "authorName": null,
    "authorEmail": null,
    "authorAvatar": null,
    "created_at": "2020-07-14T20:13:01.649Z",
    "updated_at": "2020-07-14T20:13:01.670Z"
}

Public API specification

Get Comments

GET <host>/comments/<content-type>:<id>

Return a hierarchical tree structure of comments for specified instance of Content Type like for example Article with ID: 1

Example URL: https://localhost:1337/comments/article:1

Example response body

[
    {
        -- Comment Model fields ---,
        children: [
            {
                -- Comment Model fields ---,
                children: [...]
            },
            ...
        ]
    },
    ...
]

Get Comments (flat structure)

GET <host>/comments/<content-type>:<id>/flat

Return a flat structure of comments for specified instance of Content Type like for example Article with ID: 1

Example URL: https://localhost:1337/comments/article:1/flat

Example response body

[
    {
        -- Comment Model fields ---
    },
    {
        -- Comment Model fields ---
    },
    ...
]

Possible response codes

  • 200 - Successful. Response with list of comments (can be empty)
  • 400 - Bad Request. Requested list for not valid / not existing Content Type

Post a Comment

POST <host>/comments/<content-type>:<id>

Posts a Comment related to specified instance of Content Type like for example Article with ID: 1

Example URL: https://localhost:1337/comments/article:1

Example request body

Generic (non Strapi User)

{
	"authorId": "<any ID like value>",
	"authorName": "Joe Doe",
	"authorEmail": "[email protected]",
	"content": "My sample response",
	"threadOf": 2, // id of comment we would like to start / continue the thread (Optional)
	"related": [{
		"refId": 1,
		"ref": "article",
		"field": "comments"
	}] 
}

Strapi user

{
	"authorUser": 1,
	"content": "My sample response",
	"threadOf": 2, // id of comment we would like to start / continue the thread (Optional)
	"related": [{
		"refId": 1,
		"ref": "article",
		"field": "comments"
	}] 
}

Example response body

{
    -- Comment Model fields ---
}

Possible response codes

  • 200 - Successful. Response with created Comment Model
  • 400 - Bad Request. Missing field values or bad words check fails. Error message will provide relevant reason.

Update Comment

PUT <host>/comments/<content-type>:<id>/comment/<commentId>

Updates a specified Comment content based on it commentId and related to specified instance of Content Type like for example Article with ID: 1

Example URL: https://localhost:1337/comments/article:1/comment/2

Example request body

Generic (non Strapi User)

{
	"authorId": "<any ID like value>",
	"authorName": "Joe Doe",
	"authorEmail": "[email protected]",
	"content": "My sample response"
}

Strapi user

{
	"authorUser": 1,
	"content": "My sample response"
}

Example response body

{
    -- Comment Model fields ---
}

Possible response codes

  • 200 - Successful. Response with updated Comment Model
  • 400 - Bad Request. Missing field values or bad words check fails. Error message will provide relevant reason.
  • 409 - Conflict. Occurs when trying to update a non existing or not own comment. Possible cause might be that authorId or authorUser mismatch with existing comment.

Like Comment

PATCH <host>/comments/<content-type>:<id>/comment/<commentId>/like

Likes a specified Comment based on it commentId and related to specified instance of Content Type like for example Article with ID: 1.

Example URL: https://localhost:1337/comments/article:1/comment/2/like

Example response body

{
    -- Comment Model fields ---
}

Possible response codes

  • 200 - Successful. Response with liked Comment Model.
  • 409 - Conflict. Occurs when trying to like a non existing comment.

Report abuse in the Comment

POST <host>/comments/<content-type>:<id>/comment/<commentId>/report-abuse

Reports abuse in specified Comment content based on it commentId and related to specified instance of Content Type like for example Article with ID: 1 and requests moderator attention.

Example URL: https://localhost:1337/comments/article:1/comment/2/report-abuse

Example request body

{
	"reason": "<reason enum>",
	"content": "This comment is not relevant"
}

Available reason enums: OTHER, BAD_WORDS, DISCRIMINATION

Example response body

{
    -- Comment Abuse Report fields ---
}

Possible response codes

  • 200 - Successful. Response with reported abuse.
  • 409 - Conflict. Occurs when trying to report an abuse to a non existing comment.

Contributing

Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!

Community support

For general help using Strapi, please refer to the official Strapi documentation. For additional help, you can use one of these channels to ask a question:

License

MIT License Copyright (c) 2020 VirtusLab Sp. z o.o. & Strapi Solutions.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].