strapi-plugin-comments 2.0.0-beta.7 β†’ 2.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.
Files changed (52) hide show
  1. package/.circleci/config.yml +1 -1
  2. package/README.md +186 -134
  3. package/__mocks__/initSetup.js +53 -0
  4. package/admin/src/components/ActionButton/styles.js +10 -0
  5. package/admin/src/components/DiscussionThread/index.js +3 -7
  6. package/admin/src/components/DiscussionThreadItem/index.js +25 -70
  7. package/admin/src/components/DiscussionThreadItem/styles.js +4 -79
  8. package/admin/src/components/DiscussionThreadItemActions/index.js +82 -40
  9. package/admin/src/components/DiscussionThreadItemActions/styles.js +1 -12
  10. package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +2 -3
  11. package/admin/src/components/DiscussionThreadItemFooter/index.js +47 -0
  12. package/admin/src/components/DiscussionThreadItemFooter/styles.js +13 -0
  13. package/admin/src/components/DiscussionThreadItemReviewAction/index.js +131 -0
  14. package/admin/src/components/IconButton/styles.js +14 -0
  15. package/admin/src/components/ReportsReviewModal/index.js +1 -1
  16. package/admin/src/components/ReportsReviewTable/index.js +12 -6
  17. package/admin/src/components/StatusBadge/index.js +17 -0
  18. package/admin/src/components/StatusBadge/styles.js +17 -0
  19. package/admin/src/pages/Details/components/DetailsEntity/index.js +42 -24
  20. package/admin/src/pages/Details/components/DetailsFilters/index.js +8 -10
  21. package/admin/src/pages/Details/index.js +6 -15
  22. package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +30 -67
  23. package/admin/src/translations/en.json +13 -15
  24. package/admin/src/utils/resolveCommentStatus.js +4 -4
  25. package/content-types/comment.js +0 -4
  26. package/package.json +8 -5
  27. package/public/assets/logo.png +0 -0
  28. package/public/assets/preview.png +0 -0
  29. package/server/controllers/client.js +7 -2
  30. package/server/controllers/utils/__tests__/functions.test.js +2 -2
  31. package/server/controllers/utils/parsers.js +3 -1
  32. package/server/graphql/mutations/createAbuseReport.js +8 -3
  33. package/server/graphql/mutations/createComment.js +8 -3
  34. package/server/graphql/mutations/removeComment.js +8 -3
  35. package/server/graphql/mutations/updateComment.js +8 -3
  36. package/server/graphql/resolvers-config.js +13 -8
  37. package/server/graphql/types/comment-nested.js +1 -1
  38. package/server/graphql/types/comment.js +0 -1
  39. package/server/graphql/types/create-comment-author.js +1 -1
  40. package/server/graphql/types/identify-comment-author.js +1 -1
  41. package/server/graphql/types/index.js +0 -1
  42. package/server/services/__tests__/common.test.js +165 -0
  43. package/server/services/admin.js +10 -7
  44. package/server/services/client.js +45 -31
  45. package/server/services/common.js +38 -16
  46. package/server/services/utils/__tests__/functions.test.js +9 -73
  47. package/server/services/utils/functions.js +23 -34
  48. package/server/utils/__tests__/functions.test.js +17 -0
  49. package/admin/src/components/DiscussionThreadItemMeta/index.js +0 -42
  50. package/admin/src/components/DiscussionThreadItemWarnings/index.js +0 -147
  51. package/admin/src/components/DiscussionThreadItemWarnings/styles.js +0 -7
  52. package/server/graphql/types/comment-author-user.js +0 -9
@@ -6,7 +6,7 @@ jobs:
6
6
  environment:
7
7
  CODECOV_TOKEN: 02e2d4e8-88c4-4e5d-99da-a9a2888634c6
8
8
  docker:
9
- - image: circleci/node:12.13.0
9
+ - image: circleci/node:14.17.3
10
10
  working_directory: ~/repo
11
11
  steps:
12
12
  - checkout
package/README.md CHANGED
@@ -1,8 +1,11 @@
1
- # Strapi v4 - Comments plugin - BETA
2
-
3
- <p align="center">
1
+ <div align="center" width="150px">
2
+ <img style="width: 150px; height: auto;" src="public/assets/logo.png" alt="Logo - Strapi Comments plugin" />
3
+ </div>
4
+ <div align="center">
5
+ <h1>Strapi v4 - Comments plugin</h1>
6
+ <p>Powerful Strapi based comments moderation tool for you and your users</p>
4
7
  <a href="https://www.npmjs.org/package/strapi-plugin-comments">
5
- <img src="https://img.shields.io/npm/v/strapi-plugin-comments/latest.svg" alt="NPM Version" />
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">
6
9
  </a>
7
10
  <a href="https://www.npmjs.org/package/strapi-plugin-comments">
8
11
  <img src="https://img.shields.io/npm/dm/strapi-plugin-comments.svg" alt="Monthly download on NPM" />
@@ -13,15 +16,38 @@
13
16
  <a href="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments">
14
17
  <img src="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments/coverage.svg?branch=master" alt="codecov.io" />
15
18
  </a>
16
- </p>
19
+ <a href="https://sharing.clickup.com/tl/xhcmx-83/strapiv-4-comments-roadmap">
20
+ <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" />
21
+ </a>
22
+ <a href="https://sharing.clickup.com/b/xhcmx-63/strapiv-4-comments-board">
23
+ <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" />
24
+ </a>
25
+ </div>
26
+
27
+ ---
28
+
29
+ <div style="margin: 20px 0" align="center">
30
+ <img style="width: 100%; height: auto;" src="public/assets/preview.png" alt="UI preview" />
31
+ </div>
32
+
17
33
 
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.
34
+ 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.
19
35
 
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)
36
+ ## ✨ Features
37
+
38
+ - **Comments Public REST + GraphQL API:** Elegant, entirely customizable and a fully extensible admin panel.
39
+ - **Strapi &amp; generic users:** Support for built-in &amp; also generic non-Strapi users that might be the comments authors.
40
+ - **Any Content Type relation:** Comments can by linked to any of your Content Types by default. Simply, you're controlling it.
41
+ - **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.
42
+ - **Automated Bad Words filtering:** By detault end users are not allowed to post abusing comments where bad words have been used.
43
+ - **Abuse Reporting & Reviewing:** Don't allow inferior language, react to reports from your community, send email notifiactions about abuse reports
23
44
 
24
- ### ⏳ Installation
45
+ ## βš™οΈ Versions
46
+
47
+ - **Strapi v4** - (current) - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
48
+ - **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3)
49
+
50
+ ## ⏳ Installation
25
51
 
26
52
  (Use **yarn** to install this plugin within your Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
27
53
 
@@ -46,7 +72,7 @@ The **Comments** plugin should appear in the **Plugins** section of Strapi sideb
46
72
 
47
73
  Enjoy πŸŽ‰
48
74
 
49
- ### πŸ– Requirements
75
+ ## πŸ– Requirements
50
76
 
51
77
  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
78
 
@@ -58,41 +84,37 @@ In our minimum support we're following [official Node.js releases timelines](htt
58
84
 
59
85
  **Supported Strapi versions**:
60
86
 
61
- - Strapi v4.0.5 (recently tested)
87
+ - Strapi v4.0.7 (recently tested)
62
88
  - Strapi v4.x
63
89
 
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.)
90
+ > 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
91
 
66
92
  **We recommend always using the latest version of Strapi to start your new projects**.
67
93
 
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
94
+ ## πŸ”§ Configuration
78
95
  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
96
 
80
97
 
81
98
  ```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',
99
+ module.exports = ({ env }) => ({
100
+ //...
101
+ comments: {
102
+ badWords: false,
103
+ moderatorRoles: ["Authenticated"],
104
+ approvalFlow: ['api::page.page'],
105
+ entryLabel: {
106
+ '*': ['Title', 'title', 'Name', 'name', 'Subject', 'subject'],
107
+ 'api::page.page': ['MyField'],
108
+ },
109
+ reportReasons: {
110
+ 'MY_CUSTOM_REASON': 'MY_CUSTOM_REASON',
111
+ },
112
+ gql: {
113
+ // ...
114
+ },
93
115
  },
94
- },
95
- ...
116
+ //...
117
+ });
96
118
  ```
97
119
 
98
120
  ### Properties
@@ -101,13 +123,37 @@ To setup amend default plugin configuration we recommend to put following snippe
101
123
  - `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.
102
124
  - `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 `*`.
103
125
  - `reportReasons` - set of enums you would like to use for issuing abuse reports. Provided by default `'BAD_LANGUAGE'`, `'DISCRIMINATION'` and `'OTHER'`.
126
+ - `gql` - specific configuration for GraphQL. See [Additional GQL Configuration](#additional-gql-configuration)
104
127
 
105
128
  ## Additional GQL Configuration
106
- 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/developer-docs/latest/plugins/graphql.html#configurations)**.
129
+ 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/developer-docs/latest/plugins/graphql.html#configurations)** and decide if you would like to call it by anyone (open for world) or only by authenticated users (Strapi users).
130
+
131
+ ```json
132
+ {
133
+ // ...
134
+ gql: {
135
+ auth: true, // Default: false
136
+ },
137
+ // ...
138
+ }
139
+ ```
140
+
141
+ ### Properties
142
+ - `auth` - does GraphQL Queries should be authenticated or not? Default: `false`
143
+
144
+ ### Queries
107
145
 
108
146
  See [available GQL specification section](#public-graphql-specification).
109
147
 
110
- ## RBAC
148
+ > If `auth` is set to `true` you must provide relevant authentication headers to all requests like for example:
149
+ >
150
+ > ```json
151
+ > {
152
+ > "Authorization": "Bearer <your token here>"
153
+ > }
154
+ > ```
155
+
156
+ ## πŸ‘€ RBAC
111
157
  Plugin provides granular permissions based on Strapi RBAC functionality.
112
158
 
113
159
  ### Mandatory permissions
@@ -121,9 +167,8 @@ Feature / Capability focused permissions:
121
167
  - _Plugins_ -> _Comments_ -> _Reports: Read_ - allows you to see the list of issued abuse reports against comments
122
168
  - _Plugins_ -> _Comments_ -> _Reports: Moderate_ - allows you to review (resolve) issued abuse reports against comments
123
169
 
124
- ## Public API Comment model
170
+ ## Base Comment model
125
171
 
126
- ### Generic (non Strapi User)
127
172
  ```json
128
173
  {
129
174
  "id": 1,
@@ -135,8 +180,8 @@ Feature / Capability focused permissions:
135
180
  "removed": null,
136
181
  "approvalStatus": "APPROVED", // Only in case of enabled approval flow. Default: null
137
182
  "author": {
138
- "id": "207ccfdc-94ba-45eb-979c-790f6f49c392",
139
- "name": "Joe Doe",
183
+ "id": "207ccfdc-94ba-45eb-979c-790f6f49c392", // For Strapi users id reflects to the format used by your Strapi
184
+ "name": "Joe Doe", // For Strapi users it is equal to 'username' field
140
185
  "email": "jdoe@sample.com",
141
186
  "avatar": null,
142
187
  },
@@ -146,44 +191,17 @@ Feature / Capability focused permissions:
146
191
  "reports": [] // Reports issued against this comment
147
192
  }
148
193
  ```
149
- ### Strapi User
150
- ```json
151
- {
152
- "id": 1,
153
- "content": "My comment content",
154
- "blocked": true,
155
- "blockedThread": null,
156
- "blockReason": null,
157
- "removed": null,
158
- "approvalStatus": "REJECTED", // Only in case of enabled approval flow. Default: null
159
- "authorUser": {
160
- "id": 1,
161
- "username": "Sample User",
162
- "email": "user@sample.com",
163
- "provider": "local",
164
- "confirmed": true,
165
- "blocked": false,
166
- "role": 1,
167
- "created_at": "2020-07-10T08:38:03.157Z",
168
- "updated_at": "2020-07-10T08:38:03.170Z"
169
- },
170
- "authorId": null,
171
- "authorName": null,
172
- "authorEmail": null,
173
- "authorAvatar": null,
174
- "createdAt": "2020-07-14T20:13:01.649Z",
175
- "updatedAt": "2020-07-14T20:13:01.670Z",
176
- "related": {}, // Related content type entity
177
- "reports": [] // Reports issued against this comment
178
- }
179
194
 
180
- ```
195
+ ## πŸ•ΈοΈ Public REST API specification
181
196
 
182
- ## Public API specification
197
+ **Strapi Users vs. Generic authors**
198
+ > Keep in mind that if you're using auth / authz your requests to setup proper user contexts it has got higher priority in order to take author data comparing to `author` property provided as part of your payload.
183
199
 
184
200
  ### Get Comments
185
201
 
186
- `GET <host>/comments/api::<collection name>.<content type name>:<entity id>`
202
+ *GraphQL equivalent: [Public GraphQL API -> Get Comments](#get-comments-1)*
203
+
204
+ `GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
187
205
 
188
206
  Return a hierarchical tree structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`
189
207
 
@@ -191,25 +209,29 @@ Return a hierarchical tree structure of comments for specified instance of Conte
191
209
 
192
210
  **Example response body**
193
211
 
194
- ```
212
+ ```json
195
213
  [
196
214
  {
197
- -- Comment Model fields ---,
215
+ // -- Comment Model fields ---,
198
216
  children: [
199
217
  {
200
- -- Comment Model fields ---,
201
- children: [...]
218
+ // -- Comment Model fields ---,
219
+ children: [
220
+ // ...
221
+ ]
202
222
  },
203
- ...
223
+ // ...
204
224
  ]
205
225
  },
206
- ...
226
+ // ...
207
227
  ]
208
228
  ```
209
229
 
210
230
  ### Get Comments (flat structure)
211
231
 
212
- `GET <host>/comments/api::<collection name>.<content type name>:<entity id>/flat`
232
+ *GraphQL equivalent: [Public GraphQL API -> Get Comments (flat structure)](#get-comments-flat-structure-1)*
233
+
234
+ `GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>/flat`
213
235
 
214
236
  Return a flat structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`
215
237
 
@@ -217,15 +239,15 @@ Return a flat structure of comments for specified instance of Content Type like
217
239
 
218
240
  **Example response body**
219
241
 
220
- ```
242
+ ```json
221
243
  [
222
244
  {
223
- -- Comment Model fields ---
245
+ // -- Comment Model fields ---
224
246
  },
225
247
  {
226
- -- Comment Model fields ---
248
+ // -- Comment Model fields ---
227
249
  },
228
- ...
250
+ // ...
229
251
  ]
230
252
  ```
231
253
 
@@ -235,7 +257,9 @@ Return a flat structure of comments for specified instance of Content Type like
235
257
 
236
258
  ### Post a Comment
237
259
 
238
- `POST <host>/comments/api::<collection name>.<content type name>:<entity id>`
260
+ *GraphQL equivalent: [Public GraphQL API -> Post a Comments](#post-a-comment-1)*
261
+
262
+ `POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
239
263
 
240
264
  Posts a Comment related to specified instance of Content Type like for example `Page` with `ID: 1`
241
265
 
@@ -244,23 +268,25 @@ Posts a Comment related to specified instance of Content Type like for example `
244
268
  **Example request body**
245
269
 
246
270
  *Generic (non Strapi User)*
247
- ```
271
+ ```json
248
272
  {
249
- "author": {
250
- "id": "<any ID like value>",
251
- "name": "Joe Doe",
252
- "email": "jdoe@sample.com",
253
- "avatar": "<any image url>"
254
- },
273
+ "author": {
274
+ "id": "<any ID like value>",
275
+ "name": "Joe Doe",
276
+ "email": "jdoe@sample.com",
277
+ "avatar": "<any image url>"
278
+ },
255
279
  "content": "My sample response",
256
280
  "threadOf": 2, // id of comment we would like to start / continue the thread (Optional)
257
281
  }
258
282
  ```
259
283
 
260
284
  *Strapi user*
261
- ```
285
+
286
+ > Author is taken directly from the request context
287
+
288
+ ```json
262
289
  {
263
- "authorUser": 1, // id of a author user. Optional in case of 'enableUsers: true' in the plugin configuration
264
290
  "content": "My sample response",
265
291
  "threadOf": 2, // id of comment we would like to start / continue the thread (Optional)
266
292
  }
@@ -268,9 +294,9 @@ Posts a Comment related to specified instance of Content Type like for example `
268
294
 
269
295
  **Example response body**
270
296
 
271
- ```
297
+ ```json
272
298
  {
273
- -- Comment Model fields ---
299
+ // -- Comment Model fields ---
274
300
  }
275
301
  ```
276
302
 
@@ -280,7 +306,9 @@ Posts a Comment related to specified instance of Content Type like for example `
280
306
 
281
307
  ### Update Comment
282
308
 
283
- `PUT <host>/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>`
309
+ *GraphQL equivalent: [Public GraphQL API -> Update Comments](#update-comment-1)*
310
+
311
+ `PUT <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>`
284
312
 
285
313
  Updates a specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`
286
314
 
@@ -289,28 +317,30 @@ Updates a specified Comment content based on it `commentId` and related to speci
289
317
  **Example request body**
290
318
 
291
319
  *Generic (non Strapi User)*
292
- ```
320
+ ```json
293
321
  {
294
- "author": {
295
- "id": "<any ID like value>"
296
- },
322
+ "author": {
323
+ "id": "<any ID like value>"
324
+ },
297
325
  "content": "My sample response"
298
326
  }
299
327
  ```
300
328
 
301
329
  *Strapi user*
302
- ```
330
+
331
+ > Author is taken directly from the request context
332
+
333
+ ```json
303
334
  {
304
- "authorUser": 1, // id of a author user. Optional in case of 'enableUsers: true' in the plugin configuration
305
335
  "content": "My sample response"
306
336
  }
307
337
  ```
308
338
 
309
339
  **Example response body**
310
340
 
311
- ```
341
+ ```json
312
342
  {
313
- -- Comment Model fields ---
343
+ // -- Comment Model fields ---
314
344
  }
315
345
  ```
316
346
 
@@ -321,7 +351,9 @@ Updates a specified Comment content based on it `commentId` and related to speci
321
351
 
322
352
  ### Delete Comment
323
353
 
324
- `DELETE <host>/comments/api::<collection name>.<content type name>:<entity id>/<commentId>?authorId=<authorId>`
354
+ *GraphQL equivalent: [Public GraphQL API -> Delete Comment](#delete-comment-1)*
355
+
356
+ `DELETE <host>/api/comments/api::<collection name>.<content type name>:<entity id>/<commentId>?authorId=<authorId>`
325
357
 
326
358
  Deletes a specified Comment based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`.
327
359
 
@@ -329,9 +361,9 @@ Deletes a specified Comment based on it `commentId` and related to specified ins
329
361
 
330
362
  **Example response body**
331
363
 
332
- ```
364
+ ```json
333
365
  {
334
- -- Empty Response ---
366
+ // -- Empty Response ---
335
367
  }
336
368
  ```
337
369
 
@@ -342,7 +374,9 @@ Deletes a specified Comment based on it `commentId` and related to specified ins
342
374
 
343
375
  ### Issue Abuse Report against specified Comment
344
376
 
345
- `POST <host>/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>/report-abuse`
377
+ *GraphQL equivalent: [Public GraphQL API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment-1)*
378
+
379
+ `POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>/report-abuse`
346
380
 
347
381
  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.
348
382
 
@@ -350,7 +384,7 @@ Reports abuse in specified Comment content based on it `commentId` and related t
350
384
 
351
385
  **Example request body**
352
386
 
353
- ```
387
+ ```json
354
388
  {
355
389
  "reason": "<reason enum>",
356
390
  "content": "This comment is not relevant"
@@ -361,9 +395,9 @@ Reports abuse in specified Comment content based on it `commentId` and related t
361
395
 
362
396
  **Example response body**
363
397
 
364
- ```
398
+ ```json
365
399
  {
366
- -- Comment Abuse Report fields ---
400
+ // -- Comment Abuse Report fields ---
367
401
  }
368
402
  ```
369
403
 
@@ -371,13 +405,17 @@ Reports abuse in specified Comment content based on it `commentId` and related t
371
405
  - `200` - Successful. Response with reported abuse.
372
406
  - `409` - Conflict. Occurs when trying to report an abuse to a non existing comment.
373
407
 
374
- ## Public GraphQL specification
408
+ ## πŸ•ΈοΈ Public GraphQL specification
375
409
 
376
- > *To test all queries and understand the schemas use GraphQL Playground exposed by `@strapi/plugin-graphql` on `http://localhost:1337/graphql`*
410
+ **Strapi Users vs. Generic authors**
411
+ > Keep in mind that if you're using auth / authz your requests to setup proper user contexts it has got higher priority in order to take author data comparing to `author` property provided as part of your payload.
412
+
413
+ **Testing**
414
+ > To test all queries and understand the schemas use GraphQL Playground exposed by `@strapi/plugin-graphql` on `http://localhost:1337/graphql`
377
415
 
378
416
  ### Get Comments
379
417
 
380
- *REST API equivalent: [Public API -> Get Comments](#get-comments)*
418
+ *REST API equivalent: [Public REST API -> Get Comments](#get-comments)*
381
419
 
382
420
  **Example request**
383
421
 
@@ -417,14 +455,14 @@ query {
417
455
  "name": "Joe Doe"
418
456
  }
419
457
  },
420
- //...
458
+ // ...
421
459
  ]
422
460
  }
423
461
  ```
424
462
 
425
463
  ### Get Comments (flat structure)
426
464
 
427
- *REST API equivalent: [Public API -> Get Comments (flat structure)](#get-comments-flat-structure)*
465
+ *REST API equivalent: [Public REST API -> Get Comments (flat structure)](#get-comments-flat-structure)*
428
466
 
429
467
  **Example request**
430
468
 
@@ -464,7 +502,7 @@ query {
464
502
  "id": 6,
465
503
  "content": "Text to search for"
466
504
  },
467
- //...
505
+ // ...
468
506
  ],
469
507
  "threadOf": null,
470
508
  "author": {
@@ -472,7 +510,7 @@ query {
472
510
  "name": "Joe Doe"
473
511
  }
474
512
  },
475
- //...
513
+ // ...
476
514
  ]
477
515
  }
478
516
  }
@@ -480,7 +518,7 @@ query {
480
518
 
481
519
  ### Post a Comment
482
520
 
483
- *REST API equivalent: [Public API -> Post a Comment](#post-a-comment)*
521
+ *REST API equivalent: [Public REST API -> Post a Comment](#post-a-comment)*
484
522
 
485
523
  **Example request**
486
524
 
@@ -491,7 +529,7 @@ mutation createComment {
491
529
  relation: "api::page.page:1"
492
530
  content: "Hello World!"
493
531
  threadOf: 3
494
- author: { id: "12345678", name: "John Wick", email: "test@test.pl" }
532
+ author: { id: "12345678", name: "John Wick", email: "test@test.pl" } # Optional if using auth / authz requests
495
533
  }
496
534
  ) {
497
535
  id
@@ -529,7 +567,7 @@ mutation createComment {
529
567
 
530
568
  ### Update Comment
531
569
 
532
- *REST API equivalent: [Public API -> Update Comment](#update-comment)*
570
+ *REST API equivalent: [Public REST API -> Update Comment](#update-comment)*
533
571
 
534
572
  **Example request**
535
573
 
@@ -540,7 +578,7 @@ mutation updateComment {
540
578
  id: 34
541
579
  relation: "api::page.page:1"
542
580
  content: "I've changed it!"
543
- author: { id: "12345678" }
581
+ author: { id: "12345678" } # Optional if using auth / authz requests
544
582
  }
545
583
  ) {
546
584
  id
@@ -582,14 +620,18 @@ mutation updateComment {
582
620
 
583
621
  ### Delete Comment
584
622
 
585
- *REST API equivalent: [Public API -> Delete Comment](#delete-comment)*
623
+ *REST API equivalent: [Public REST API -> Delete Comment](#delete-comment)*
586
624
 
587
625
  **Example request**
588
626
 
589
627
  ```graphql
590
628
  mutation removeComment {
591
629
  removeComment(
592
- input: { id: 33, relation: "api::page.page:1", author: { id: "12345678" } }
630
+ input: {
631
+ id: 33,
632
+ relation: "api::page.page:1",
633
+ author: { id: "12345678" } # Optional if using auth / authz requests
634
+ }
593
635
  ) {
594
636
  id
595
637
  removed
@@ -612,7 +654,7 @@ mutation removeComment {
612
654
 
613
655
  ### Issue Abuse Report against specified Comment
614
656
 
615
- *REST API equivalent: [Public API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment)*
657
+ *REST API equivalent: [Public REST API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment)*
616
658
 
617
659
  **Example request body**
618
660
 
@@ -663,22 +705,32 @@ mutation createAbuseReport {
663
705
  }
664
706
  ```
665
707
 
666
- ## Examples
708
+ ## 🧩 Examples
709
+
710
+ 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.
667
711
 
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.
712
+ ## 🀝 Contributing
669
713
 
670
- ## Contributing
714
+ <div>
715
+ <a href="https://sharing.clickup.com/tl/xhcmx-83/strapiv-4-comments-roadmap">
716
+ <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" />
717
+ </a>
718
+ <a href="https://sharing.clickup.com/b/xhcmx-63/strapiv-4-comments-board">
719
+ <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" />
720
+ </a>
721
+ </div>
671
722
 
672
723
  Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
673
724
 
674
- ## Community support
725
+ ## πŸ‘¨β€πŸ’» Community support
675
726
 
676
727
  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
728
 
678
- - [Discord](https://discord.strapi.io/) We're present on official Strapi Discord workspace. Look for @cyp3r and DM.
729
+ - [Discord](https://discord.strapi.io/) We're present on official Strapi Discord workspace. Find us by `[VirtusLab]` prefix and DM.
679
730
  - [Slack - VirtusLab Open Source](https://virtuslab-oss.slack.com) We're present on a public channel #strapi-molecules
680
731
  - [GitHub](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/issues) (Bug reports, Contributions, Questions and Discussions)
732
+ - [E-mail](mailto:strapi@virtuslab.com) - we will respond back as soon as possible
681
733
 
682
- ## License
734
+ ## πŸ“ License
683
735
 
684
736
  [MIT License](LICENSE.md) Copyright (c) [VirtusLab Sp. z o.o.](https://virtuslab.com/) &amp; [Strapi Solutions](https://strapi.io/).