strapi-plugin-comments 3.0.0-beta.1 → 3.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +81 -122
- package/dist/_chunks/{index-D3iNqWZT.mjs → index-BC5Odn17.mjs} +5 -5
- package/dist/_chunks/{index-BBcsmSTs.mjs → index-BIorFYba.mjs} +448 -256
- package/dist/_chunks/{index-Bcck91A8.js → index-COoWcAcA.js} +1290 -1144
- package/dist/_chunks/{index-CY_AVWS-.js → index-Ccb93U47.js} +445 -253
- package/dist/_chunks/{index-D9MOkoQ2.mjs → index-D1DAMkhj.mjs} +20 -26
- package/dist/_chunks/{index-BFPteXuP.js → index-R1krliyC.js} +5 -5
- package/dist/_chunks/{index-DJ32APz-.mjs → index-_exHAK6u.mjs} +1290 -1144
- package/dist/_chunks/{index-BXEk5PWx.js → index-k7z0V0lj.js} +20 -26
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/api/client.d.ts +30 -50
- package/dist/admin/src/api/schemas.d.ts +432 -756
- package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
- package/dist/admin/src/hooks/useAPI.d.ts +30 -50
- package/dist/admin/src/hooks/useCommentsAll.d.ts +6 -10
- package/dist/admin/src/hooks/useReports.d.ts +6 -10
- package/dist/server/index.js +212 -157
- package/dist/server/index.mjs +212 -157
- package/dist/server/src/{@types-v5 → @types}/utils.d.ts +4 -0
- package/dist/server/src/bootstrap.d.ts +1 -1
- package/dist/server/src/config/index.d.ts +30 -0
- package/dist/server/src/content-types/index.d.ts +1 -1
- package/dist/server/src/controllers/admin.controller.d.ts +108 -29
- package/dist/server/src/controllers/client.controller.d.ts +121 -24
- package/dist/server/src/controllers/index.d.ts +300 -88
- package/dist/server/src/controllers/settings.controller.d.ts +33 -1
- package/dist/server/src/graphql/index.d.ts +1 -1
- package/dist/server/src/graphql/mutations/getCreateAbuseReport.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getCreateComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getRemoveComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/getUpdateComment.d.ts +10 -4
- package/dist/server/src/graphql/mutations/index.d.ts +2 -2
- package/dist/server/src/graphql/queries/findAllFlat.d.ts +18 -6
- package/dist/server/src/graphql/queries/findAllInHierarchy.d.ts +10 -4
- package/dist/server/src/graphql/queries/findAllPerAuthor.d.ts +18 -6
- package/dist/server/src/graphql/queries/index.d.ts +2 -2
- package/dist/server/src/graphql/types/getComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentAuthorType.d.ts +1 -1
- package/dist/server/src/graphql/types/getCommentNested.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateCommentAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getCreateReport.d.ts +1 -1
- package/dist/server/src/graphql/types/getId.d.ts +1 -1
- package/dist/server/src/graphql/types/getIdentityAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getRemoveComment.d.ts +1 -1
- package/dist/server/src/graphql/types/getReport.d.ts +1 -1
- package/dist/server/src/graphql/types/getReportReason.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseFindAll.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseFindAllPerAuthor.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponseMeta.d.ts +1 -1
- package/dist/server/src/graphql/types/getResponsePagination.d.ts +1 -1
- package/dist/server/src/graphql/types/getUpdateComment.d.ts +1 -1
- package/dist/server/src/graphql/types/index.d.ts +1 -1
- package/dist/server/src/index.d.ts +931 -315
- package/dist/server/src/register/custom-fields/index.d.ts +1 -1
- package/dist/server/src/register/index.d.ts +1 -1
- package/dist/server/src/repositories/comment.repository.d.ts +10 -1
- package/dist/server/src/repositories/index.d.ts +0 -2
- package/dist/server/src/repositories/report.comment.repository.d.ts +38 -1
- package/dist/server/src/repositories/store.repository.d.ts +159 -3
- package/dist/server/src/repositories/utils.d.ts +1 -3
- package/dist/server/src/routes/admin.routes.d.ts +1 -1
- package/dist/server/src/routes/client.routes.d.ts +1 -1
- package/dist/server/src/routes/index.d.ts +2 -2
- package/dist/server/src/services/admin/admin.service.d.ts +232 -78
- package/dist/server/src/services/admin/utils.d.ts +1 -1
- package/dist/server/src/services/client.service.d.ts +178 -67
- package/dist/server/src/services/common.service.d.ts +60 -19
- package/dist/server/src/services/gql.service.d.ts +1 -1
- package/dist/server/src/services/index.d.ts +615 -223
- package/dist/server/src/services/settings.service.d.ts +25 -1
- package/dist/server/src/services/utils/functions.d.ts +1 -3
- package/dist/server/src/test/utils.d.ts +1 -0
- package/dist/server/src/utils/constants.d.ts +1 -1
- package/dist/server/src/utils/getConfig.d.ts +2 -2
- package/dist/server/src/utils/getPluginService.d.ts +2 -2
- package/dist/server/src/utils/throwError.d.ts +1 -1
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +16 -9
- package/dist/server/src/validators/api/controllers/settings.controller.validator.d.ts +4 -0
- package/dist/server/src/validators/repositories/comment.schema.d.ts +18 -3
- package/dist/server/src/validators/repositories/comment.validator.d.ts +384 -72
- package/dist/server/src/validators/repositories/reports.validator.d.ts +60 -18
- package/dist/server/src/validators/utils.d.ts +1 -1
- package/package.json +18 -12
- /package/dist/server/src/{@types-v5 → @types}/controllers.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/index.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/repositories.d.ts +0 -0
- /package/dist/server/src/{@types-v5 → @types}/routes.d.ts +0 -0
package/README.md
CHANGED
|
@@ -1,29 +1,27 @@
|
|
|
1
|
-
<div align="center"
|
|
2
|
-
<img style="width: 150px; height: auto;" src="
|
|
1
|
+
<div align="center" style="max-width: 10rem; margin: 0 auto">
|
|
2
|
+
<img style="width: 150px; height: auto;" src="https://www.sensinum.com/img/open-source/strapi-plugin-comments/logo.png" alt="Logo - Strapi Comments plugin" />
|
|
3
3
|
</div>
|
|
4
4
|
<div align="center">
|
|
5
|
-
<h1>Strapi v5 - Comments plugin
|
|
5
|
+
<h1>Strapi v5 - Comments plugin</h1>
|
|
6
6
|
<p>Powerful Strapi based comments moderation tool for you and your users</p>
|
|
7
7
|
<a href="https://www.npmjs.org/package/strapi-plugin-comments">
|
|
8
|
-
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/VirtusLab-Open-Source/strapi-plugin-comments
|
|
8
|
+
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/VirtusLab-Open-Source/strapi-plugin-comments?label=npm&logo=npm">
|
|
9
9
|
</a>
|
|
10
10
|
<a href="https://www.npmjs.org/package/strapi-plugin-comments">
|
|
11
11
|
<img src="https://img.shields.io/npm/dm/strapi-plugin-comments.svg" alt="Monthly download on NPM" />
|
|
12
12
|
</a>
|
|
13
13
|
<a href="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-comments">
|
|
14
|
-
<img src="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-comments
|
|
14
|
+
<img src="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-comments.svg?style=shield" alt="CircleCI" />
|
|
15
15
|
</a>
|
|
16
16
|
<a href="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments">
|
|
17
|
-
<img src="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments/coverage.svg?branch=
|
|
17
|
+
<img src="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments/coverage.svg?branch=master" alt="codecov.io" />
|
|
18
18
|
</a>
|
|
19
19
|
</div>
|
|
20
20
|
|
|
21
|
-
## ⚠️ This is the beta version for Strapi v5
|
|
22
|
-
|
|
23
21
|
---
|
|
24
22
|
|
|
25
23
|
<div style="margin: 20px 0" align="center">
|
|
26
|
-
<img style="width: 100%; height: auto;" src="
|
|
24
|
+
<img style="width: 100%; height: auto;" src="https://www.sensinum.com/img/open-source/strapi-plugin-comments/preview.png" alt="UI preview" />
|
|
27
25
|
</div>
|
|
28
26
|
|
|
29
27
|
A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and much more.
|
|
@@ -39,31 +37,29 @@ A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provid
|
|
|
39
37
|
- [Plugin file](#in-v202-and-older--default-configuration-state-for-v203-and-newer)
|
|
40
38
|
6. [🕸️ Public API - REST](#%EF%B8%8F-public-rest-api-specification)
|
|
41
39
|
7. [🕸️ Public API - GraphQL](#%EF%B8%8F-public-graphql-specification)
|
|
42
|
-
8. [
|
|
43
|
-
9. [
|
|
44
|
-
10. [
|
|
40
|
+
8. [🌿 Model lifecycle hooks](#model-life-cycle-hooks)
|
|
41
|
+
9. [⚗️ Custom fields](#-custom-fields)
|
|
42
|
+
10. [🧩 Examples](#-examples)
|
|
43
|
+
11. [💬 FAQ](#-faq)
|
|
44
|
+
12. [🤝 Contributing](#-contributing)
|
|
45
|
+
13. [👨💻 Community support](#-community-support)
|
|
45
46
|
|
|
46
47
|
## 💎 Versions
|
|
47
|
-
|
|
48
|
-
- **Strapi
|
|
48
|
+
|
|
49
|
+
- **Strapi v5** - (current) [v3.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
|
|
50
|
+
- **Strapi v4** - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v4)
|
|
49
51
|
- **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3)
|
|
50
52
|
|
|
51
53
|
## ✨ Features
|
|
52
54
|
|
|
53
55
|
- **Comments Public REST + GraphQL API:** Elegant, entirely customizable and a fully extensible admin panel.
|
|
54
56
|
- **Strapi & generic users:** Support for built-in & also generic non-Strapi users that might be the comments authors.
|
|
55
|
-
- **Strapi Custom Fields support:** Improve an experience of your Content Types by using [dedicated set of custom fields](https://docs-next.strapi.io/
|
|
57
|
+
- **Strapi Custom Fields support:** Improve an experience of your Content Types by using [dedicated set of custom fields](https://docs-next.strapi.io/dev-docs/custom-fields) for each of them and automate client side processing of Comments.
|
|
56
58
|
- **Any Content Type relation:** Comments can be linked to any of your Content Types by default. Simply, you're controlling it.
|
|
57
59
|
- **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.
|
|
58
60
|
- **Automated Bad Words filtering:** By default end users are not allowed to post abusing comments where bad words have been used.
|
|
59
61
|
- **Abuse Reporting & Reviewing:** Don't allow inferior language, react to reports from your community, send email notifications about issued reports
|
|
60
62
|
|
|
61
|
-
## ⚙️ Versions
|
|
62
|
-
|
|
63
|
-
- **Strapi v5** - (current) - [v3.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/v5)
|
|
64
|
-
- **Strapi v4** - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
|
|
65
|
-
- **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3)
|
|
66
|
-
|
|
67
63
|
## ⏳ Installation
|
|
68
64
|
|
|
69
65
|
### Via Strapi Marketplace
|
|
@@ -71,7 +67,7 @@ A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provid
|
|
|
71
67
|
As a ✅ **verified** plugin by Strapi team we're available on the [**Strapi Marketplace**](https://market.strapi.io/plugins/strapi-plugin-comments) as well as **In-App Marketplace** where you can follow the installation instructions.
|
|
72
68
|
|
|
73
69
|
<div style="margin: 20px 0" align="center">
|
|
74
|
-
<img style="width: 100%; height: auto;" src="
|
|
70
|
+
<img style="width: 100%; height: auto;" src="https://www.sensinum.com/img/open-source/strapi-plugin-comments/marketplace.png" alt="Strapi In-App Marketplace" />
|
|
75
71
|
</div>
|
|
76
72
|
|
|
77
73
|
### Via command line
|
|
@@ -89,58 +85,29 @@ yarn build
|
|
|
89
85
|
yarn develop
|
|
90
86
|
```
|
|
91
87
|
|
|
92
|
-
or just run Strapi in the development mode with `--watch-admin` option:
|
|
93
|
-
|
|
94
|
-
```bash
|
|
95
|
-
yarn develop --watch-admin
|
|
96
|
-
```
|
|
97
|
-
|
|
98
88
|
The **Comments** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
|
|
99
89
|
|
|
100
90
|
As a next step you must configure your the plugin by the way you want to. See [**Configuration**](#🔧-configuration) section.
|
|
101
91
|
|
|
102
92
|
All done. Enjoy 🎉
|
|
103
93
|
|
|
104
|
-
### Working in development mode
|
|
105
|
-
|
|
106
|
-
1. Clone repository
|
|
107
|
-
|
|
108
|
-
```
|
|
109
|
-
git clone git@github.com:VirtusLab-Open-Source/strapi-plugin-comments.git
|
|
110
|
-
```
|
|
111
|
-
|
|
112
|
-
2. Create a soft link in your strapi project to plugin build folder
|
|
113
|
-
|
|
114
|
-
```sh
|
|
115
|
-
ln -s <your path>/strapi-plugin-comments/build <your path>/strapi-project/src/plugins/comments
|
|
116
|
-
```
|
|
117
|
-
|
|
118
|
-
3. Run develop or build command
|
|
119
|
-
|
|
120
|
-
```ts
|
|
121
|
-
// Watch for file changes
|
|
122
|
-
yarn develop
|
|
123
|
-
// or run build without nodemon
|
|
124
|
-
yarn build:dev
|
|
125
|
-
```
|
|
126
|
-
|
|
127
94
|
## 🖐 Requirements
|
|
128
95
|
|
|
129
|
-
Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under [Installation Requirements](https://docs.strapi.io/
|
|
96
|
+
Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under [Installation Requirements](https://docs.strapi.io/dev-docs/intro).
|
|
130
97
|
|
|
131
98
|
**Minimum environment requirements**
|
|
132
99
|
|
|
133
|
-
- Node.js `>=18.0.0 <=
|
|
100
|
+
- Node.js `>=18.0.0 <=22.x.x`
|
|
134
101
|
- NPM `>=6.x.x`
|
|
135
102
|
|
|
136
103
|
In our minimum support we're following [official Node.js releases timelines](https://nodejs.org/en/about/releases/).
|
|
137
104
|
|
|
138
105
|
**Supported Strapi versions**:
|
|
139
106
|
|
|
140
|
-
- Strapi v5.
|
|
107
|
+
- Strapi v5.7.0 (recently tested)
|
|
141
108
|
- Strapi v5.x
|
|
142
109
|
|
|
143
|
-
> This plugin is designed for **Strapi v5
|
|
110
|
+
> This plugin is designed for **Strapi v5**. To get support for other Strapi versions, please follow the [versions](#-versions) section.
|
|
144
111
|
|
|
145
112
|
**Plugin dependencies**
|
|
146
113
|
- `@strapi/plugin-graphql` - required to run GraphQL handled by this plugin
|
|
@@ -149,25 +116,25 @@ In our minimum support we're following [official Node.js releases timelines](htt
|
|
|
149
116
|
|
|
150
117
|
## 🔧 Configuration
|
|
151
118
|
|
|
152
|
-
To start your journey with **Comments plugin** you must first setup it using the dedicated Settings page
|
|
119
|
+
To start your journey with **Comments plugin** you must first setup it using the dedicated Settings page or for any version, put your configuration in `config/plugins.{js|ts}`. Anyway we're recommending the click-through option where your configuration is going to be properly validated.
|
|
153
120
|
|
|
154
|
-
###
|
|
121
|
+
### Settings page
|
|
155
122
|
|
|
156
|
-
|
|
123
|
+
On the dedicated page, you will be able to set up all crucial properties which drive the plugin and customize each individual collection for which **Comments plugin** should be enabled.
|
|
157
124
|
|
|
158
125
|
<div style="margin: 20px 0" align="center">
|
|
159
|
-
<img style="width: 100%; height: auto;" src="
|
|
126
|
+
<img style="width: 100%; height: auto;" src="https://www.sensinum.com/img/open-source/strapi-plugin-comments/configuration.png" alt="Plugin configuration" />
|
|
160
127
|
</div>
|
|
161
128
|
|
|
162
129
|
> _Note_
|
|
163
|
-
> Default configuration for your plugin is fetched from `config/plugins.js` or directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.
|
|
130
|
+
> Default configuration for your plugin is fetched from `config/plugins.{js|ts}` or directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.
|
|
164
131
|
|
|
165
|
-
###
|
|
132
|
+
### File
|
|
166
133
|
|
|
167
|
-
To setup amend default plugin configuration we recommend to put following snippet as part of `config/plugins.js` or `config/<env>/plugins.js` file. If the file does not exist yet, you have to create it manually. If you've got already configurations for other plugins stores by this way, use just the `comments` part within exising `plugins` item.
|
|
134
|
+
To setup amend default plugin configuration we recommend to put following snippet as part of `config/plugins.{js|ts}` or `config/<env>/plugins.{js|ts}` file. If the file does not exist yet, you have to create it manually. If you've got already configurations for other plugins stores by this way, use just the `comments` part within exising `plugins` item.
|
|
168
135
|
|
|
169
|
-
```
|
|
170
|
-
module.exports = ({ env }) => ({
|
|
136
|
+
```ts
|
|
137
|
+
module.exports = ({ env }) => ({
|
|
171
138
|
//...
|
|
172
139
|
comments: {
|
|
173
140
|
enabled: true,
|
|
@@ -196,7 +163,7 @@ module.exports = ({ env }) => ({
|
|
|
196
163
|
|
|
197
164
|
- `enabledCollections` - list of Collection and Single Types for which plugin should be enabled in format like `'api::<collection name>.<content type name>'`. By default it's empty and none comments are not enabled for any of type in Strapi.
|
|
198
165
|
- `no-profanity` - Enabled support for [profanity filtering](https://www.npmjs.com/package/no-profanity). Can be turned off or altered using the [options reference](https://www.npmjs.com/package/no-profanity?activeTab=readme#options). Default value: `true`.
|
|
199
|
-
- `moderatorRoles` - Optional list of names of roles. Users with those roles will be notified by email when a new abuse report is created. This feature requires a built-in [Strapi email plugin](https://docs.strapi.io/
|
|
166
|
+
- `moderatorRoles` - Optional list of names of roles. Users with those roles will be notified by email when a new abuse report is created. This feature requires a built-in [Strapi email plugin](https://docs.strapi.io/dev-docs/plugins/email) configured.
|
|
200
167
|
- `approvalFlow` - list of Content Types which are supporting approval flow. Values must be in format like `'api::<collection name>.<content type name>'`. For not included, posted comments are going to be immediately visible.
|
|
201
168
|
- `entryLabel` - ordered list of property names per Content Type to generate related entity label. Keys must be in format like `'api::<collection name>.<content type name>'`. Default formatting set as `*`.
|
|
202
169
|
- `reportReasons` - set of enums you would like to use for issuing abuse reports. Provided by default `'BAD_LANGUAGE'`, `'DISCRIMINATION'` and `'OTHER'`.
|
|
@@ -205,10 +172,10 @@ module.exports = ({ env }) => ({
|
|
|
205
172
|
|
|
206
173
|
## Additional GQL Configuration
|
|
207
174
|
|
|
208
|
-
All you need to do is to install and enable `@strapi/plugin-graphql` for you instance based on the **[official Strapi v4 docs](https://docs.strapi.io/
|
|
175
|
+
All you need to do is to install and enable `@strapi/plugin-graphql` for you instance based on the **[official Strapi v4 docs](https://docs.strapi.io/dev-docs/plugins/graphql#configurations)** and decide if you would like to call it by anyone (open for world) or only by authenticated users (Strapi users).
|
|
209
176
|
|
|
210
177
|
> **Important!**
|
|
211
|
-
> If you're using `config/plugins.js` to configure your plugins , please put `comments` property before `graphql`. Otherwise types are not going to be properly added to GraphQL Schema. That's because of dynamic types which base on plugin configuration which are added on `boostrap` stage, not `register`. This is not valid if you're using `graphql` plugin without any custom configuration, so most of cases in real.
|
|
178
|
+
> If you're using `config/plugins.{js|ts}` to configure your plugins , please put `comments` property before `graphql`. Otherwise types are not going to be properly added to GraphQL Schema. That's because of dynamic types which base on plugin configuration which are added on `boostrap` stage, not `register`. This is not valid if you're using `graphql` plugin without any custom configuration, so most of cases in real.
|
|
212
179
|
|
|
213
180
|
```json
|
|
214
181
|
{
|
|
@@ -259,7 +226,7 @@ Feature / Capability focused permissions:
|
|
|
259
226
|
|
|
260
227
|
```json
|
|
261
228
|
{
|
|
262
|
-
"
|
|
229
|
+
"documentId": "njx99iv4p4txuqp307ye8625",
|
|
263
230
|
"content": "My comment content",
|
|
264
231
|
"blocked": null,
|
|
265
232
|
"blockedThread": true,
|
|
@@ -290,11 +257,11 @@ Feature / Capability focused permissions:
|
|
|
290
257
|
|
|
291
258
|
_GraphQL equivalent: [Public GraphQL API -> Get Comments](#get-comments-1)_
|
|
292
259
|
|
|
293
|
-
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
|
|
260
|
+
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity document id>`
|
|
294
261
|
|
|
295
|
-
Return a hierarchical tree structure of comments for specified instance of Content Type like for example `Page` with `
|
|
262
|
+
Return a hierarchical tree structure of comments for specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625`.
|
|
296
263
|
|
|
297
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
264
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625`
|
|
298
265
|
|
|
299
266
|
**Example response body**
|
|
300
267
|
|
|
@@ -318,18 +285,18 @@ Return a hierarchical tree structure of comments for specified instance of Conte
|
|
|
318
285
|
|
|
319
286
|
#### Strapi REST API properties support:
|
|
320
287
|
|
|
321
|
-
- [field selection](https://docs.strapi.io/
|
|
322
|
-
- [sorting](https://docs.strapi.io/
|
|
288
|
+
- [field selection](https://docs.strapi.io/dev-docs/api/rest/populate-select#field-selection)
|
|
289
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
323
290
|
|
|
324
291
|
### Get Comments (flat structure)
|
|
325
292
|
|
|
326
293
|
_GraphQL equivalent: [Public GraphQL API -> Get Comments (flat structure)](#get-comments-flat-structure-1)_
|
|
327
294
|
|
|
328
|
-
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>/flat`
|
|
295
|
+
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity document id>/flat`
|
|
329
296
|
|
|
330
|
-
Return a flat structure of comments for specified instance of Content Type like for example `Page` with `
|
|
297
|
+
Return a flat structure of comments for specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625`
|
|
331
298
|
|
|
332
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
299
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625/flat`
|
|
333
300
|
|
|
334
301
|
**Example response body**
|
|
335
302
|
|
|
@@ -359,10 +326,10 @@ Return a flat structure of comments for specified instance of Content Type like
|
|
|
359
326
|
|
|
360
327
|
#### Strapi REST API properties support:
|
|
361
328
|
|
|
362
|
-
- [filtering](https://docs.strapi.io/
|
|
363
|
-
- [field selection](https://docs.strapi.io/
|
|
364
|
-
- [sorting](https://docs.strapi.io/
|
|
365
|
-
- [pagination](https://docs.strapi.io/
|
|
329
|
+
- [filtering](https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#filtering)
|
|
330
|
+
- [field selection](https://docs.strapi.io/dev-docs/api/rest/populate-select#field-selection)
|
|
331
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
332
|
+
- [pagination](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#pagination)
|
|
366
333
|
|
|
367
334
|
### Get Comments (by Author)
|
|
368
335
|
|
|
@@ -372,8 +339,8 @@ _GraphQL equivalent: [Public GraphQL API -> Get Comments (by Author)](#get-comme
|
|
|
372
339
|
|
|
373
340
|
Return a flat structure of comments by specified Author for example `Author` with `ID: 1`
|
|
374
341
|
|
|
375
|
-
**Example URL**: `https://localhost:1337/api/comments/author/1` - get comments by `ID:1` of Strapi User
|
|
376
|
-
**Example URL**: `https://localhost:1337/api/comments/author/1/generic` - get comments by `ID:1` of Generic User
|
|
342
|
+
**Example URL**: `https://localhost:1337/api/comments/author/1` - get comments by `ID: 1` of Strapi User
|
|
343
|
+
**Example URL**: `https://localhost:1337/api/comments/author/1/generic` - get comments by `ID: 1` of Generic User
|
|
377
344
|
|
|
378
345
|
#### Skipping fields
|
|
379
346
|
|
|
@@ -409,20 +376,20 @@ To skip a field from the response you can use a query param called `omit`. It is
|
|
|
409
376
|
|
|
410
377
|
#### Strapi REST API properties support:
|
|
411
378
|
|
|
412
|
-
- [filtering](https://docs.strapi.io/
|
|
413
|
-
- [field selection](https://docs.strapi.io/
|
|
414
|
-
- [sorting](https://docs.strapi.io/
|
|
415
|
-
- [pagination](https://docs.strapi.io/
|
|
379
|
+
- [filtering](https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#filtering)
|
|
380
|
+
- [field selection](https://docs.strapi.io/dev-docs/api/rest/populate-select#field-selection)
|
|
381
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
382
|
+
- [pagination](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#pagination)
|
|
416
383
|
|
|
417
384
|
### Post a Comment
|
|
418
385
|
|
|
419
386
|
_GraphQL equivalent: [Public GraphQL API -> Post a Comments](#post-a-comment-1)_
|
|
420
387
|
|
|
421
|
-
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
|
|
388
|
+
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity document id>`
|
|
422
389
|
|
|
423
|
-
Posts a Comment related to specified instance of Content Type like for example `Page` with `
|
|
390
|
+
Posts a Comment related to specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625`
|
|
424
391
|
|
|
425
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
392
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625`
|
|
426
393
|
|
|
427
394
|
**Example request body**
|
|
428
395
|
|
|
@@ -469,11 +436,11 @@ _Strapi user_
|
|
|
469
436
|
|
|
470
437
|
_GraphQL equivalent: [Public GraphQL API -> Update Comments](#update-comment-1)_
|
|
471
438
|
|
|
472
|
-
`PUT <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>`
|
|
439
|
+
`PUT <host>/api/comments/api::<collection name>.<content type name>:<entity document id>/comment/<commentId>`
|
|
473
440
|
|
|
474
|
-
Updates a specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `
|
|
441
|
+
Updates a specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625`
|
|
475
442
|
|
|
476
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
443
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625/comment/2`
|
|
477
444
|
|
|
478
445
|
**Example request body**
|
|
479
446
|
|
|
@@ -516,11 +483,11 @@ _Strapi user_
|
|
|
516
483
|
|
|
517
484
|
_GraphQL equivalent: [Public GraphQL API -> Delete Comment](#delete-comment-1)_
|
|
518
485
|
|
|
519
|
-
`DELETE <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>?authorId=<authorId>`
|
|
486
|
+
`DELETE <host>/api/comments/api::<collection name>.<content type name>:<entity document id>/comment/<commentId>?authorId=<authorId>`
|
|
520
487
|
|
|
521
|
-
Deletes a specified Comment based on it `commentId` and related to specified instance of Content Type like for example `Page` with `
|
|
488
|
+
Deletes a specified Comment based on it `commentId` and related to specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625`.
|
|
522
489
|
|
|
523
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
490
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625/comment/1?authorId=1`
|
|
524
491
|
|
|
525
492
|
**Example response body**
|
|
526
493
|
|
|
@@ -539,11 +506,11 @@ Deletes a specified Comment based on it `commentId` and related to specified ins
|
|
|
539
506
|
|
|
540
507
|
_GraphQL equivalent: [Public GraphQL API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment-1)_
|
|
541
508
|
|
|
542
|
-
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>/report-abuse`
|
|
509
|
+
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity document id>/comment/<commentId>/report-abuse`
|
|
543
510
|
|
|
544
|
-
Reports abuse in specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `
|
|
511
|
+
Reports abuse in specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `documentId: njx99iv4p4txuqp307ye8625` and requests moderator attention.
|
|
545
512
|
|
|
546
|
-
**Example URL**: `https://localhost:1337/api/comments/api::page.page:
|
|
513
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:njx99iv4p4txuqp307ye8625/comment/2/report-abuse`
|
|
547
514
|
|
|
548
515
|
**Example request body**
|
|
549
516
|
|
|
@@ -587,7 +554,7 @@ _REST API equivalent: [Public REST API -> Get Comments](#get-comments)_
|
|
|
587
554
|
|
|
588
555
|
```graphql
|
|
589
556
|
query {
|
|
590
|
-
findAllInHierarchy(relation: "api::page.page:
|
|
557
|
+
findAllInHierarchy(relation: "api::page.page:njx99iv4p4txuqp307ye8625") {
|
|
591
558
|
id
|
|
592
559
|
content
|
|
593
560
|
blocked
|
|
@@ -637,7 +604,7 @@ query {
|
|
|
637
604
|
|
|
638
605
|
#### Strapi GraphQL API properties support:
|
|
639
606
|
|
|
640
|
-
- [sorting](https://docs.strapi.io/
|
|
607
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
641
608
|
|
|
642
609
|
### Get Comments (flat structure)
|
|
643
610
|
|
|
@@ -648,7 +615,7 @@ _REST API equivalent: [Public REST API -> Get Comments (flat structure)](#get-co
|
|
|
648
615
|
```graphql
|
|
649
616
|
query {
|
|
650
617
|
findAllFlat(
|
|
651
|
-
relation: "api::page.page:
|
|
618
|
+
relation: "api::page.page:njx99iv4p4txuqp307ye8625"
|
|
652
619
|
filters: { content: { contains: "Test" } }
|
|
653
620
|
) {
|
|
654
621
|
id
|
|
@@ -684,13 +651,14 @@ query {
|
|
|
684
651
|
// ...
|
|
685
652
|
]
|
|
686
653
|
}
|
|
654
|
+
}
|
|
687
655
|
```
|
|
688
656
|
|
|
689
657
|
#### Strapi GraphQL API properties support:
|
|
690
658
|
|
|
691
|
-
- [filtering](https://docs.strapi.io/
|
|
692
|
-
- [sorting](https://docs.strapi.io/
|
|
693
|
-
- [pagination](https://docs.strapi.io/
|
|
659
|
+
- [filtering](https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#filtering)
|
|
660
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
661
|
+
- [pagination](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#pagination)
|
|
694
662
|
|
|
695
663
|
### Get Comments (by Author)
|
|
696
664
|
|
|
@@ -737,9 +705,9 @@ query {
|
|
|
737
705
|
|
|
738
706
|
#### Strapi GraphQL API properties support:
|
|
739
707
|
|
|
740
|
-
- [filtering](https://docs.strapi.io/
|
|
741
|
-
- [sorting](https://docs.strapi.io/
|
|
742
|
-
- [pagination](https://docs.strapi.io/
|
|
708
|
+
- [filtering](https://docs.strapi.io/dev-docs/api/rest/filters-locale-publication#filtering)
|
|
709
|
+
- [sorting](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#sorting)
|
|
710
|
+
- [pagination](https://docs.strapi.io/dev-docs/api/rest/sort-pagination#pagination)
|
|
743
711
|
|
|
744
712
|
### Post a Comment
|
|
745
713
|
|
|
@@ -751,7 +719,7 @@ _REST API equivalent: [Public REST API -> Post a Comment](#post-a-comment)_
|
|
|
751
719
|
mutation createComment {
|
|
752
720
|
createComment(
|
|
753
721
|
input: {
|
|
754
|
-
relation: "api::page.page:
|
|
722
|
+
relation: "api::page.page:njx99iv4p4txuqp307ye8625"
|
|
755
723
|
content: "Hello World!"
|
|
756
724
|
threadOf: 3
|
|
757
725
|
author: { id: "12345678", name: "John Wick", email: "test@test.pl" } # Optional if using auth / authz requests
|
|
@@ -801,7 +769,7 @@ mutation updateComment {
|
|
|
801
769
|
updateComment(
|
|
802
770
|
input: {
|
|
803
771
|
id: 34
|
|
804
|
-
relation: "api::page.page:
|
|
772
|
+
relation: "api::page.page:njx99iv4p4txuqp307ye8625"
|
|
805
773
|
content: "I've changed it!"
|
|
806
774
|
author: { id: "12345678" } # Optional if using auth / authz requests
|
|
807
775
|
}
|
|
@@ -854,7 +822,7 @@ mutation removeComment {
|
|
|
854
822
|
removeComment(
|
|
855
823
|
input: {
|
|
856
824
|
id: 33
|
|
857
|
-
relation: "api::page.page:
|
|
825
|
+
relation: "api::page.page:njx99iv4p4txuqp307ye8625"
|
|
858
826
|
author: { id: "12345678" } # Optional if using auth / authz requests
|
|
859
827
|
}
|
|
860
828
|
) {
|
|
@@ -888,7 +856,7 @@ mutation createAbuseReport {
|
|
|
888
856
|
createAbuseReport(
|
|
889
857
|
input: {
|
|
890
858
|
commentId: 34
|
|
891
|
-
relation: "api::page.page:
|
|
859
|
+
relation: "api::page.page:njx99iv4p4txuqp307ye8625"
|
|
892
860
|
reason: BAD_LANGUAGE
|
|
893
861
|
content: "Rude language"
|
|
894
862
|
}
|
|
@@ -932,13 +900,13 @@ _Available reason enums:_ `BAD_WORDS`, `OTHER`, `DISCRIMINATION` (want more? See
|
|
|
932
900
|
|
|
933
901
|
## 🧩 Examples
|
|
934
902
|
|
|
935
|
-
Live example of plugin usage can be found in the [VirtusLab Strapi Examples](https://github.com/VirtusLab/strapi-examples/tree/master/strapi-
|
|
903
|
+
Live example of plugin usage can be found in the [VirtusLab Strapi Examples](https://github.com/VirtusLab/strapi-examples/tree/master/strapi-plugin-comments) repository.
|
|
936
904
|
|
|
937
905
|
## ⚗️ Custom fields
|
|
938
906
|
|
|
939
907
|
For developers who upgrades their Strapi instance custom field from Comments plugin is available. Custom field can be picked from content types' edit page or added in definition file.
|
|
940
908
|
|
|
941
|
-
Read more about this feature in [Strapi's docs](https://docs-next.strapi.io/
|
|
909
|
+
Read more about this feature in [Strapi's docs](https://docs-next.strapi.io/dev-docs/custom-fields).
|
|
942
910
|
|
|
943
911
|
## Model lifecycle hooks
|
|
944
912
|
|
|
@@ -982,15 +950,6 @@ Example:
|
|
|
982
950
|
|
|
983
951
|
## 🤝 Contributing
|
|
984
952
|
|
|
985
|
-
<div>
|
|
986
|
-
<a href="https://sharing.clickup.com/tl/xhcmx-83/strapiv-4-comments-roadmap">
|
|
987
|
-
<img src="https://img.shields.io/website?down_message=roadmap&label=product&up_message=roadmap&url=https%3A%2F%2Fsharing.clickup.com%2Ftl%2Fxhcmx-83%2Fstrapiv-4-comments-roadmap" />
|
|
988
|
-
</a>
|
|
989
|
-
<a href="https://sharing.clickup.com/b/xhcmx-63/strapiv-4-comments-board">
|
|
990
|
-
<img src="https://img.shields.io/website?down_message=board&label=product&up_color=blue&up_message=board&url=https%3A%2F%2Fsharing.clickup.com%2Fb%2Fxhcmx-63%2Fstrapiv-4-comments-board" />
|
|
991
|
-
</a>
|
|
992
|
-
</div>
|
|
993
|
-
|
|
994
953
|
Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
|
|
995
954
|
|
|
996
955
|
## 👨💻 Community support
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { a0 as Alert, e as Button, f as ForwardRef$
|
|
2
|
+
import { a0 as Alert, e as Button, f as ForwardRef$4x, B as Box, a1 as ForwardRef$1f, F as Flex, T as Typography, Y as Grid, m as Field, a2 as MultiSelect, a3 as MultiSelectOption, a4 as Accordion, a5 as SwitchImpl, a6 as Toggle, a7 as ForwardRef$59 } from "./index-BIorFYba.mjs";
|
|
3
3
|
import { useTracking, useNotification, Page, Layouts, Form } from "@strapi/strapi/admin";
|
|
4
4
|
import { useMutation, useQuery, useQueryClient, QueryClient } from "@tanstack/react-query";
|
|
5
|
-
import { u as useAPI, f as CommonProviders, a as usePermissions, g as getMessage, l as lodashExports, e as ConfirmationDialog } from "./index-
|
|
5
|
+
import { u as useAPI, f as CommonProviders, a as usePermissions, g as getMessage, l as lodashExports, e as ConfirmationDialog } from "./index-_exHAK6u.mjs";
|
|
6
6
|
import { useMemo, useRef, useState, useCallback } from "react";
|
|
7
7
|
import styled from "styled-components";
|
|
8
8
|
const RenderIf = ({
|
|
@@ -136,7 +136,7 @@ const Settings = () => {
|
|
|
136
136
|
title: getMessage("page.settings.header.title"),
|
|
137
137
|
subtitle: getMessage("page.settings.header.description"),
|
|
138
138
|
as: "h2",
|
|
139
|
-
primaryAction: /* @__PURE__ */ jsx(RenderIf, { condition: canSettingsChange, children: /* @__PURE__ */ jsx(Button, { type: "submit", startIcon: /* @__PURE__ */ jsx(ForwardRef$
|
|
139
|
+
primaryAction: /* @__PURE__ */ jsx(RenderIf, { condition: canSettingsChange, children: /* @__PURE__ */ jsx(Button, { type: "submit", startIcon: /* @__PURE__ */ jsx(ForwardRef$4x, {}), onClick: onTriggerSubmit, children: getMessage("page.settings.actions.submit") }) })
|
|
140
140
|
}
|
|
141
141
|
),
|
|
142
142
|
/* @__PURE__ */ jsxs(Layouts.Content, { children: [
|
|
@@ -346,7 +346,7 @@ const Settings = () => {
|
|
|
346
346
|
Button,
|
|
347
347
|
{
|
|
348
348
|
variant: "danger-light",
|
|
349
|
-
startIcon: /* @__PURE__ */ jsx(ForwardRef$
|
|
349
|
+
startIcon: /* @__PURE__ */ jsx(ForwardRef$59, {}),
|
|
350
350
|
onClick,
|
|
351
351
|
children: getMessage("page.settings.actions.restore")
|
|
352
352
|
}
|
|
@@ -354,7 +354,7 @@ const Settings = () => {
|
|
|
354
354
|
onConfirm: restoreSettingsMutation.mutate,
|
|
355
355
|
title: getMessage("page.settings.actions.restore.confirmation.header"),
|
|
356
356
|
labelConfirm: getMessage("page.settings.actions.restore.confirmation.button.confirm"),
|
|
357
|
-
iconConfirm: /* @__PURE__ */ jsx(ForwardRef$
|
|
357
|
+
iconConfirm: /* @__PURE__ */ jsx(ForwardRef$59, {}),
|
|
358
358
|
children: getMessage("page.settings.actions.restore.confirmation.description")
|
|
359
359
|
}
|
|
360
360
|
)
|