strapi-plugin-comments 2.0.0-beta.7 → 2.0.0-rc.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 CHANGED
@@ -1,6 +1,7 @@
1
- # Strapi v4 - Comments plugin - BETA
2
-
3
- <p align="center">
1
+ <div align="center">
2
+ <img style="width: 150px; height: auto;" src="public/assets/logo.png" alt="Logo - Strapi Comments plugin" />
3
+ <h1>Strapi v4 - Comments plugin</h1>
4
+ <p>Powerfull Strapi based comments moderation tool for you and your users</p>
4
5
  <a href="https://www.npmjs.org/package/strapi-plugin-comments">
5
6
  <img src="https://img.shields.io/npm/v/strapi-plugin-comments/latest.svg" alt="NPM Version" />
6
7
  </a>
@@ -13,15 +14,32 @@
13
14
  <a href="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments">
14
15
  <img src="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments/coverage.svg?branch=master" alt="codecov.io" />
15
16
  </a>
16
- </p>
17
+ </div>
18
+
19
+ ---
17
20
 
18
- 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 more.
21
+ <div style="margin: 20px 0" align="center">
22
+ <img style="width: 100%; height: auto;" src="public/assets/preview.png" alt="UI preview" />
23
+ </div>
19
24
 
20
- ### Versions
21
- - **Stable** - [v1.0.4](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
22
- - **Beta** - v4 support - [v2.0.0-beta.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/feat/strapi-v4)
23
25
 
24
- ### ⏳ Installation
26
+ 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.
27
+
28
+ ## ✨ Features
29
+
30
+ - **Comments Public REST + GraphQL API:** Elegant, entirely customizable and a fully extensible admin panel.
31
+ - **Strapi &amp; generic users:** Support for built-in &amp; also generic non-Strapi users that might be the comments authors.
32
+ - **Any Content Type relation:** Comments can by linked to any of your Content Types by default. Simply, you're controlling it.
33
+ - **Moderation Panel:** Search & Filter through the bucket with your auditory comments. Manage them by blocking single ones or full threads. All in combined list &amp; hierarchical tree view of threads.
34
+ - **Automated Bad Words filtering:** By detault end users are not allowed to post abusing comments where bad words have been used.
35
+ - **Abuse Reporting & Reviewing:** Don't allow inferior language, react to reports from your community, send email notifiactions about abuse reports
36
+
37
+ ## ⚙️ Versions
38
+
39
+ - **Strapi v4** - (current) - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
40
+ - **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3)
41
+
42
+ ## ⏳ Installation
25
43
 
26
44
  (Use **yarn** to install this plugin within your Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
27
45
 
@@ -42,11 +60,11 @@ or just run Strapi in the development mode with `--watch-admin` option:
42
60
  yarn develop --watch-admin
43
61
  ```
44
62
 
45
- The **Comments** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
63
+ The **Comments** plugin should appear in the navigation menu of Strapi after you run app again.
46
64
 
47
65
  Enjoy 🎉
48
66
 
49
- ### 🖐 Requirements
67
+ ## 🖐 Requirements
50
68
 
51
69
  Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under [Installation Requirements](https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html).
52
70
 
@@ -61,38 +79,31 @@ In our minimum support we're following [official Node.js releases timelines](htt
61
79
  - Strapi v4.0.5 (recently tested)
62
80
  - Strapi v4.x
63
81
 
64
- (This plugin is not working with v3.x and not may work with the older Strapi v4 versions, but these are not tested nor officially supported at this time.)
82
+ > This plugin is designed for **Strapi v4** and is not working with v3.x. To get version for **Strapi v3** install version [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3).
65
83
 
66
84
  **We recommend always using the latest version of Strapi to start your new projects**.
67
85
 
68
- ## Features
69
-
70
- - **Comments Public API:** Elegant, entirely customizable and a fully extensible admin panel.
71
- - **Strapi &amp; generic users:** Support for built-in &amp; also generic non-Strapi users that might be the comments authors.
72
- - **Any Content Type relation:** Comments can by linked to any of your Content Types by default. Simply, you're controlling it.
73
- - **Moderation Panel:** Search & Filter through the bucket with your auditory comments. Manage them by blocking single ones or full threads. All in combined list &amp; hierarchical tree view of threads.
74
- - **Automated Bad Words filtering:** By detault end users are not allowed to post abusing comments where bad words have been used.
75
- - **Abuse Reporting & Reviewing:** Don't allow inferior language, react to reports from your community, send email notifiactions about abuse reports
76
-
77
- ## Configuration
86
+ ## 🔧 Configuration
78
87
  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.
79
88
 
80
89
 
81
90
  ```js
82
- ...
83
- comments: {
84
- badWords: false,
85
- moderatorRoles: ["Authenticated"],
86
- approvalFlow: ['api::page.page'],
87
- entryLabel: {
88
- '*': ['Title', 'title', 'Name', 'name', 'Subject', 'subject'],
89
- 'api::page.page': ['MyField'],
90
- },
91
- reportReasons: {
92
- 'MY_CUSTOM_REASON': 'MY_CUSTOM_REASON',
91
+ module.exports = ({ env }) => ({
92
+ //...
93
+ comments: {
94
+ badWords: false,
95
+ moderatorRoles: ["Authenticated"],
96
+ approvalFlow: ['api::page.page'],
97
+ entryLabel: {
98
+ '*': ['Title', 'title', 'Name', 'name', 'Subject', 'subject'],
99
+ 'api::page.page': ['MyField'],
100
+ },
101
+ reportReasons: {
102
+ 'MY_CUSTOM_REASON': 'MY_CUSTOM_REASON',
103
+ },
93
104
  },
94
- },
95
- ...
105
+ //...
106
+ });
96
107
  ```
97
108
 
98
109
  ### Properties
@@ -107,7 +118,7 @@ All you need to do is to install and enable `@strapi/plugin-graphql` for you ins
107
118
 
108
119
  See [available GQL specification section](#public-graphql-specification).
109
120
 
110
- ## RBAC
121
+ ## 👤 RBAC
111
122
  Plugin provides granular permissions based on Strapi RBAC functionality.
112
123
 
113
124
  ### Mandatory permissions
@@ -121,7 +132,7 @@ Feature / Capability focused permissions:
121
132
  - _Plugins_ -> _Comments_ -> _Reports: Read_ - allows you to see the list of issued abuse reports against comments
122
133
  - _Plugins_ -> _Comments_ -> _Reports: Moderate_ - allows you to review (resolve) issued abuse reports against comments
123
134
 
124
- ## Public API Comment model
135
+ ## Base Comment model
125
136
 
126
137
  ### Generic (non Strapi User)
127
138
  ```json
@@ -179,10 +190,12 @@ Feature / Capability focused permissions:
179
190
 
180
191
  ```
181
192
 
182
- ## Public API specification
193
+ ## 🕸️ Public REST API specification
183
194
 
184
195
  ### Get Comments
185
196
 
197
+ *GraphQL equivalent: [Public GraphQL API -> Get Comments](#get-comments-1)*
198
+
186
199
  `GET <host>/comments/api::<collection name>.<content type name>:<entity id>`
187
200
 
188
201
  Return a hierarchical tree structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`
@@ -191,24 +204,28 @@ Return a hierarchical tree structure of comments for specified instance of Conte
191
204
 
192
205
  **Example response body**
193
206
 
194
- ```
207
+ ```json
195
208
  [
196
209
  {
197
- -- Comment Model fields ---,
210
+ // -- Comment Model fields ---,
198
211
  children: [
199
212
  {
200
- -- Comment Model fields ---,
201
- children: [...]
213
+ // -- Comment Model fields ---,
214
+ children: [
215
+ // ...
216
+ ]
202
217
  },
203
- ...
218
+ // ...
204
219
  ]
205
220
  },
206
- ...
221
+ // ...
207
222
  ]
208
223
  ```
209
224
 
210
225
  ### Get Comments (flat structure)
211
226
 
227
+ *GraphQL equivalent: [Public GraphQL API -> Get Comments (flat structure)](#get-comments-flat-structure-1)*
228
+
212
229
  `GET <host>/comments/api::<collection name>.<content type name>:<entity id>/flat`
213
230
 
214
231
  Return a flat structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`
@@ -217,15 +234,15 @@ Return a flat structure of comments for specified instance of Content Type like
217
234
 
218
235
  **Example response body**
219
236
 
220
- ```
237
+ ```json
221
238
  [
222
239
  {
223
- -- Comment Model fields ---
240
+ // -- Comment Model fields ---
224
241
  },
225
242
  {
226
- -- Comment Model fields ---
243
+ // -- Comment Model fields ---
227
244
  },
228
- ...
245
+ // ...
229
246
  ]
230
247
  ```
231
248
 
@@ -235,6 +252,8 @@ Return a flat structure of comments for specified instance of Content Type like
235
252
 
236
253
  ### Post a Comment
237
254
 
255
+ *GraphQL equivalent: [Public GraphQL API -> Post a Comments](#post-a-comment-1)*
256
+
238
257
  `POST <host>/comments/api::<collection name>.<content type name>:<entity id>`
239
258
 
240
259
  Posts a Comment related to specified instance of Content Type like for example `Page` with `ID: 1`
@@ -244,7 +263,7 @@ Posts a Comment related to specified instance of Content Type like for example `
244
263
  **Example request body**
245
264
 
246
265
  *Generic (non Strapi User)*
247
- ```
266
+ ```json
248
267
  {
249
268
  "author": {
250
269
  "id": "<any ID like value>",
@@ -258,7 +277,7 @@ Posts a Comment related to specified instance of Content Type like for example `
258
277
  ```
259
278
 
260
279
  *Strapi user*
261
- ```
280
+ ```json
262
281
  {
263
282
  "authorUser": 1, // id of a author user. Optional in case of 'enableUsers: true' in the plugin configuration
264
283
  "content": "My sample response",
@@ -268,9 +287,9 @@ Posts a Comment related to specified instance of Content Type like for example `
268
287
 
269
288
  **Example response body**
270
289
 
271
- ```
290
+ ```json
272
291
  {
273
- -- Comment Model fields ---
292
+ // -- Comment Model fields ---
274
293
  }
275
294
  ```
276
295
 
@@ -280,6 +299,8 @@ Posts a Comment related to specified instance of Content Type like for example `
280
299
 
281
300
  ### Update Comment
282
301
 
302
+ *GraphQL equivalent: [Public GraphQL API -> Update Comments](#update-comment-1)*
303
+
283
304
  `PUT <host>/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>`
284
305
 
285
306
  Updates a specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`
@@ -289,7 +310,7 @@ Updates a specified Comment content based on it `commentId` and related to speci
289
310
  **Example request body**
290
311
 
291
312
  *Generic (non Strapi User)*
292
- ```
313
+ ```json
293
314
  {
294
315
  "author": {
295
316
  "id": "<any ID like value>"
@@ -299,7 +320,7 @@ Updates a specified Comment content based on it `commentId` and related to speci
299
320
  ```
300
321
 
301
322
  *Strapi user*
302
- ```
323
+ ```json
303
324
  {
304
325
  "authorUser": 1, // id of a author user. Optional in case of 'enableUsers: true' in the plugin configuration
305
326
  "content": "My sample response"
@@ -308,9 +329,9 @@ Updates a specified Comment content based on it `commentId` and related to speci
308
329
 
309
330
  **Example response body**
310
331
 
311
- ```
332
+ ```json
312
333
  {
313
- -- Comment Model fields ---
334
+ // -- Comment Model fields ---
314
335
  }
315
336
  ```
316
337
 
@@ -321,6 +342,8 @@ Updates a specified Comment content based on it `commentId` and related to speci
321
342
 
322
343
  ### Delete Comment
323
344
 
345
+ *GraphQL equivalent: [Public GraphQL API -> Delete Comment](#delete-comment-1)*
346
+
324
347
  `DELETE <host>/comments/api::<collection name>.<content type name>:<entity id>/<commentId>?authorId=<authorId>`
325
348
 
326
349
  Deletes a specified Comment based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`.
@@ -329,9 +352,9 @@ Deletes a specified Comment based on it `commentId` and related to specified ins
329
352
 
330
353
  **Example response body**
331
354
 
332
- ```
355
+ ```json
333
356
  {
334
- -- Empty Response ---
357
+ // -- Empty Response ---
335
358
  }
336
359
  ```
337
360
 
@@ -342,6 +365,8 @@ Deletes a specified Comment based on it `commentId` and related to specified ins
342
365
 
343
366
  ### Issue Abuse Report against specified Comment
344
367
 
368
+ *GraphQL equivalent: [Public GraphQL API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment-1)*
369
+
345
370
  `POST <host>/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>/report-abuse`
346
371
 
347
372
  Reports abuse in specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1` and requests moderator attention.
@@ -350,7 +375,7 @@ Reports abuse in specified Comment content based on it `commentId` and related t
350
375
 
351
376
  **Example request body**
352
377
 
353
- ```
378
+ ```json
354
379
  {
355
380
  "reason": "<reason enum>",
356
381
  "content": "This comment is not relevant"
@@ -361,9 +386,9 @@ Reports abuse in specified Comment content based on it `commentId` and related t
361
386
 
362
387
  **Example response body**
363
388
 
364
- ```
389
+ ```json
365
390
  {
366
- -- Comment Abuse Report fields ---
391
+ // -- Comment Abuse Report fields ---
367
392
  }
368
393
  ```
369
394
 
@@ -371,13 +396,13 @@ Reports abuse in specified Comment content based on it `commentId` and related t
371
396
  - `200` - Successful. Response with reported abuse.
372
397
  - `409` - Conflict. Occurs when trying to report an abuse to a non existing comment.
373
398
 
374
- ## Public GraphQL specification
399
+ ## 🕸️ Public GraphQL specification
375
400
 
376
401
  > *To test all queries and understand the schemas use GraphQL Playground exposed by `@strapi/plugin-graphql` on `http://localhost:1337/graphql`*
377
402
 
378
403
  ### Get Comments
379
404
 
380
- *REST API equivalent: [Public API -> Get Comments](#get-comments)*
405
+ *REST API equivalent: [Public REST API -> Get Comments](#get-comments)*
381
406
 
382
407
  **Example request**
383
408
 
@@ -417,14 +442,14 @@ query {
417
442
  "name": "Joe Doe"
418
443
  }
419
444
  },
420
- //...
445
+ // ...
421
446
  ]
422
447
  }
423
448
  ```
424
449
 
425
450
  ### Get Comments (flat structure)
426
451
 
427
- *REST API equivalent: [Public API -> Get Comments (flat structure)](#get-comments-flat-structure)*
452
+ *REST API equivalent: [Public REST API -> Get Comments (flat structure)](#get-comments-flat-structure)*
428
453
 
429
454
  **Example request**
430
455
 
@@ -464,7 +489,7 @@ query {
464
489
  "id": 6,
465
490
  "content": "Text to search for"
466
491
  },
467
- //...
492
+ // ...
468
493
  ],
469
494
  "threadOf": null,
470
495
  "author": {
@@ -472,7 +497,7 @@ query {
472
497
  "name": "Joe Doe"
473
498
  }
474
499
  },
475
- //...
500
+ // ...
476
501
  ]
477
502
  }
478
503
  }
@@ -480,7 +505,7 @@ query {
480
505
 
481
506
  ### Post a Comment
482
507
 
483
- *REST API equivalent: [Public API -> Post a Comment](#post-a-comment)*
508
+ *REST API equivalent: [Public REST API -> Post a Comment](#post-a-comment)*
484
509
 
485
510
  **Example request**
486
511
 
@@ -529,7 +554,7 @@ mutation createComment {
529
554
 
530
555
  ### Update Comment
531
556
 
532
- *REST API equivalent: [Public API -> Update Comment](#update-comment)*
557
+ *REST API equivalent: [Public REST API -> Update Comment](#update-comment)*
533
558
 
534
559
  **Example request**
535
560
 
@@ -582,7 +607,7 @@ mutation updateComment {
582
607
 
583
608
  ### Delete Comment
584
609
 
585
- *REST API equivalent: [Public API -> Delete Comment](#delete-comment)*
610
+ *REST API equivalent: [Public REST API -> Delete Comment](#delete-comment)*
586
611
 
587
612
  **Example request**
588
613
 
@@ -612,7 +637,7 @@ mutation removeComment {
612
637
 
613
638
  ### Issue Abuse Report against specified Comment
614
639
 
615
- *REST API equivalent: [Public API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment)*
640
+ *REST API equivalent: [Public REST API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment)*
616
641
 
617
642
  **Example request body**
618
643
 
@@ -663,15 +688,15 @@ mutation createAbuseReport {
663
688
  }
664
689
  ```
665
690
 
666
- ## Examples
691
+ ## 🧩 Examples
667
692
 
668
- 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.
693
+ Live example of plugin usage can be found in the [VirtusLab Strapi Examples](https://github.com/VirtusLab/strapi-examples/tree/master/strapi-v4-plugin-comments) repository.
669
694
 
670
- ## Contributing
695
+ ## 🤝 Contributing
671
696
 
672
697
  Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
673
698
 
674
- ## Community support
699
+ ## 👨‍💻 Community support
675
700
 
676
701
  For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/). For additional help, you can use one of these channels to ask a question:
677
702
 
@@ -679,6 +704,6 @@ For general help using Strapi, please refer to [the official Strapi documentatio
679
704
  - [Slack - VirtusLab Open Source](https://virtuslab-oss.slack.com) We're present on a public channel #strapi-molecules
680
705
  - [GitHub](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/issues) (Bug reports, Contributions, Questions and Discussions)
681
706
 
682
- ## License
707
+ ## 📝 License
683
708
 
684
709
  [MIT License](LICENSE.md) Copyright (c) [VirtusLab Sp. z o.o.](https://virtuslab.com/) &amp; [Strapi Solutions](https://strapi.io/).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "strapi-plugin-comments",
3
- "version": "2.0.0-beta.7",
3
+ "version": "2.0.0-rc.1",
4
4
  "description": "Strapi - Comments plugin",
5
5
  "strapi": {
6
6
  "name": "comments",
Binary file
Binary file