strapi-plugin-comments 1.0.4 → 2.0.0-beta.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 (144) hide show
  1. package/.circleci/config.yml +2 -2
  2. package/README.md +47 -125
  3. package/admin/src/components/ConfirmationDialog/index.js +56 -0
  4. package/admin/src/components/DiscussionStatus/index.js +33 -0
  5. package/admin/src/components/DiscussionThread/index.js +58 -0
  6. package/admin/src/components/DiscussionThreadItem/index.js +87 -0
  7. package/admin/src/components/DiscussionThreadItem/styles.js +87 -0
  8. package/admin/src/components/DiscussionThreadItemActions/index.js +176 -0
  9. package/admin/src/components/DiscussionThreadItemActions/styles.js +22 -0
  10. package/admin/src/components/DiscussionThreadItemMeta/index.js +31 -0
  11. package/admin/src/components/DiscussionThreadItemWarnings/index.js +137 -0
  12. package/admin/src/components/DiscussionThreadItemWarnings/styles.js +7 -0
  13. package/admin/src/components/EntityDetails/index.js +53 -0
  14. package/admin/src/{containers → components}/Initializer/index.js +4 -4
  15. package/admin/src/components/LoadingIndicatorOverlay/index.js +15 -0
  16. package/admin/src/components/LoadingIndicatorOverlay/styles.js +20 -0
  17. package/admin/src/components/Nav/index.js +45 -0
  18. package/admin/src/components/PluginIcon/index.js +12 -0
  19. package/admin/src/components/ReportsReviewModal/index.js +45 -0
  20. package/admin/src/components/ReportsReviewTable/index.js +142 -0
  21. package/admin/src/components/TableFilters/index.js +53 -0
  22. package/admin/src/components/TablePagination/index.js +35 -0
  23. package/admin/src/components/icons/comments.js +9 -0
  24. package/admin/src/index.js +56 -42
  25. package/admin/src/pages/App/index.js +32 -0
  26. package/admin/src/pages/ComingSoonPage/index.js +25 -0
  27. package/admin/src/pages/Details/index.js +109 -0
  28. package/admin/src/pages/Details/utils/api.js +41 -0
  29. package/admin/src/pages/Discover/index.js +185 -0
  30. package/admin/src/pages/Discover/utils/api.js +23 -0
  31. package/admin/src/pages/Discover/utils/filtersSchema.js +9 -0
  32. package/admin/src/permissions.js +13 -37
  33. package/admin/src/pluginId.js +2 -4
  34. package/admin/src/translations/en.json +72 -37
  35. package/admin/src/translations/fr.json +1 -0
  36. package/admin/src/utils/axiosInstance.js +35 -0
  37. package/admin/src/utils/constants.js +25 -6
  38. package/admin/src/utils/getApiUrl.js +5 -0
  39. package/admin/src/utils/getMessage.js +14 -0
  40. package/admin/src/utils/getRelatedGroups.js +5 -0
  41. package/admin/src/utils/getUrl.js +5 -0
  42. package/admin/src/utils/handleAPIError.js +15 -0
  43. package/admin/src/utils/index.js +6 -0
  44. package/codecov.yml +2 -1
  45. package/content-types/comment.js +97 -0
  46. package/content-types/index.js +11 -0
  47. package/content-types/report.js +54 -0
  48. package/package.json +11 -25
  49. package/server/bootstrap.js +5 -0
  50. package/server/config/index.js +6 -0
  51. package/server/controllers/admin.js +150 -0
  52. package/server/controllers/client.js +109 -0
  53. package/server/controllers/index.js +9 -0
  54. package/{controllers → server/controllers}/utils/__tests__/functions.test.js +0 -0
  55. package/{controllers → server/controllers}/utils/functions.js +1 -1
  56. package/server/destroy.js +5 -0
  57. package/server/index.js +22 -0
  58. package/server/register.js +5 -0
  59. package/server/routes/admin.js +92 -0
  60. package/server/routes/client.js +52 -0
  61. package/server/routes/index.js +15 -0
  62. package/server/services/admin.js +180 -0
  63. package/server/services/client.js +227 -0
  64. package/server/services/common.js +191 -0
  65. package/server/services/index.js +11 -0
  66. package/{services → server/services}/utils/__tests__/functions.test.js +0 -0
  67. package/{services → server/services}/utils/functions.js +17 -6
  68. package/server/utils/constants.js +16 -0
  69. package/{services → server}/utils/error.js +0 -0
  70. package/server/utils/functions.js +19 -0
  71. package/strapi-admin.js +3 -0
  72. package/strapi-server.js +9 -0
  73. package/admin/src/assets/images/icon-cross-blue.svg +0 -1
  74. package/admin/src/assets/images/icon_remove.svg +0 -19
  75. package/admin/src/assets/images/logo.svg +0 -5
  76. package/admin/src/components/AbuseReportsPopUp/ItemPreviewContainer.js +0 -8
  77. package/admin/src/components/AbuseReportsPopUp/ModalFooter.js +0 -31
  78. package/admin/src/components/AbuseReportsPopUp/TableContainer.js +0 -63
  79. package/admin/src/components/AbuseReportsPopUp/index.js +0 -148
  80. package/admin/src/components/Container/index.js +0 -7
  81. package/admin/src/components/EmptyView/index.js +0 -25
  82. package/admin/src/components/Filters/index.js +0 -151
  83. package/admin/src/components/Filters/index.styled.js +0 -82
  84. package/admin/src/components/Filters/utils.js +0 -21
  85. package/admin/src/components/Item/CardItem.js +0 -30
  86. package/admin/src/components/Item/CardWrapper.js +0 -10
  87. package/admin/src/components/Item/index.js +0 -107
  88. package/admin/src/components/ItemDetails/CardItem.js +0 -33
  89. package/admin/src/components/ItemDetails/CardLevelCounter.js +0 -46
  90. package/admin/src/components/ItemDetails/CardLevelCounterLink.js +0 -24
  91. package/admin/src/components/ItemDetails/CardLevelWrapper.js +0 -22
  92. package/admin/src/components/ItemDetails/CardWrapper.js +0 -52
  93. package/admin/src/components/ItemDetails/index.js +0 -167
  94. package/admin/src/components/ItemFooter/CardItemAuthor.js +0 -10
  95. package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
  96. package/admin/src/components/ItemFooter/Wrapper.js +0 -20
  97. package/admin/src/components/ItemFooter/index.js +0 -87
  98. package/admin/src/components/ItemHeader/CardHeaderBlocked.js +0 -24
  99. package/admin/src/components/ItemHeader/CardHeaderIndicator.js +0 -30
  100. package/admin/src/components/ItemHeader/CardHeaderIndicatorBlue.js +0 -11
  101. package/admin/src/components/ItemHeader/CardHeaderIndicatorRed.js +0 -11
  102. package/admin/src/components/ItemHeader/CardHeaderIndicatorsContainer.js +0 -18
  103. package/admin/src/components/ItemHeader/CardHeaderPending.js +0 -11
  104. package/admin/src/components/ItemHeader/CardHeaderReports.js +0 -40
  105. package/admin/src/components/ItemHeader/Wrapper.js +0 -16
  106. package/admin/src/components/ItemHeader/index.js +0 -97
  107. package/admin/src/components/ItemModeration/Wrapper.js +0 -19
  108. package/admin/src/components/ItemModeration/index.js +0 -84
  109. package/admin/src/components/List/Container.js +0 -20
  110. package/admin/src/components/List/index.js +0 -21
  111. package/admin/src/components/Search/index.js +0 -83
  112. package/admin/src/containers/App/Wrapper.js +0 -14
  113. package/admin/src/containers/App/index.js +0 -47
  114. package/admin/src/containers/DataManagerProvider/actions.js +0 -15
  115. package/admin/src/containers/DataManagerProvider/index.js +0 -332
  116. package/admin/src/containers/DataManagerProvider/init.js +0 -5
  117. package/admin/src/containers/DataManagerProvider/reducer.js +0 -59
  118. package/admin/src/containers/DetailsView/Wrapper.js +0 -18
  119. package/admin/src/containers/DetailsView/index.js +0 -106
  120. package/admin/src/containers/ListView/FadedWrapper.js +0 -42
  121. package/admin/src/containers/ListView/Footer.js +0 -53
  122. package/admin/src/containers/ListView/Wrapper.js +0 -17
  123. package/admin/src/containers/ListView/components.js +0 -138
  124. package/admin/src/containers/ListView/index.js +0 -45
  125. package/admin/src/containers/Panel/actions.js +0 -5
  126. package/admin/src/containers/Panel/index.js +0 -191
  127. package/admin/src/containers/Panel/index.styled.js +0 -6
  128. package/admin/src/containers/Panel/reducer.js +0 -44
  129. package/admin/src/contexts/DataManagerContext.js +0 -5
  130. package/admin/src/hooks/useDataManager.js +0 -6
  131. package/admin/src/lifecycles.js +0 -3
  132. package/admin/src/translations/index.js +0 -7
  133. package/admin/src/utils/getTrad.js +0 -5
  134. package/admin/src/utils/getTradId.js +0 -5
  135. package/config/functions/bootstrap.js +0 -62
  136. package/config/routes.json +0 -142
  137. package/config/schema.graphql.js +0 -268
  138. package/controllers/comments.js +0 -228
  139. package/models/comment.js +0 -8
  140. package/models/comment.settings.json +0 -102
  141. package/models/report.js +0 -8
  142. package/models/report.settings.json +0 -49
  143. package/services/comments.js +0 -539
  144. package/services/utils/constants.js +0 -9
@@ -1,268 +0,0 @@
1
- const BASE_COMMENTS = `
2
- id: ID!
3
- content: String!
4
- blocked: Boolean
5
- blockedThread: Boolean
6
- blockReason: String
7
- points: Int
8
- authorUser: UsersPermissionsUser
9
- authorType: String
10
- authorId: String
11
- authorName: String
12
- authorAvatar: String
13
- removed: Boolean
14
- relatedSlug: String
15
- reports: [CommentReport]
16
- approvalStatus: CommentApprovalStatus
17
- `;
18
-
19
- const configRelatedContentTypes = Object.keys(strapi.config
20
- .get('plugins.comments.relatedContentTypes') || {})
21
- .map(key => `${key}: CommentsRelatedContentType`)
22
- .join('\n');
23
- // reports: [CommentReport]
24
- module.exports = {
25
- // language=GraphQL
26
- definition: `
27
- scalar Relation
28
- enum CommentReportReason {
29
- BAD_LANGAUGE
30
- DISCRIMINATION
31
- OTHER
32
- }
33
- enum CommentApprovalStatus {
34
- PENDING
35
- APPROVED
36
- REJECTED
37
- }
38
- type CommentReport {
39
- id: ID!
40
- content: String
41
- reason: CommentReportReason!
42
- resolved: Boolean!
43
- related: Comment
44
- }
45
-
46
- type Comment {
47
- ${BASE_COMMENTS}
48
- }
49
-
50
- type CommentsInHierarchy {
51
- ${BASE_COMMENTS}
52
- children: [Comment]
53
- }
54
-
55
- type CommentsPagination {
56
- items: [Comment]!
57
- total: Int!
58
- page: Float
59
- }
60
-
61
- type CommentsWithThread {
62
- ${BASE_COMMENTS}
63
- threadOf: Comment
64
- }
65
-
66
- type CommentsFindOne {
67
- selected: CommentsWithThread
68
- level: [Comment]!
69
- }
70
-
71
- type CommentsContentTypes {
72
- key: String!
73
- value: String!
74
- }
75
-
76
- type CommentsRelatedContentType {
77
- contentManager: Boolean
78
- isSingle: Boolean
79
- url: String
80
- }
81
-
82
- type CommentsRelatedContentTypes {
83
- ${configRelatedContentTypes}
84
- }
85
-
86
- type CommentsConfig {
87
- contentsTypes: [CommentsContentTypes]!
88
- relatedContentTypes: CommentsRelatedContentTypes
89
- }
90
-
91
- type CommentsContentType {
92
- key: String!
93
- value: String
94
- }
95
-
96
- type CommentRemove {
97
- id: ID!
98
- }
99
-
100
- input NewCommentRelated {
101
- refId: String!
102
- ref: String!
103
- field: String!
104
- }
105
-
106
- input CommentNew {
107
- authorId: String
108
- authorName: String
109
- authorEmail: String
110
- content: String!
111
- authorUsername: String
112
- threadOf: String
113
- related: [NewCommentRelated!]!
114
- approvalStatus: CommentApprovalStatus
115
- }
116
- `,
117
- // language=GraphQL
118
- query: `
119
- findAllInHierarchy(relation: Relation!, where: JSON): [CommentsInHierarchy]!
120
- findAllFlat(relation: Relation!, where: JSON): [Comment]!
121
- findAll(related: Relation, entity: ID, where: JSON): CommentsPagination!
122
- findOne(id: ID!): CommentsFindOne
123
- config: CommentsConfig
124
- contentTypeName(contentType: String!): [CommentsContentType]!
125
- `,
126
- type: {
127
- Relation: 'It is related slug given when comment was created',
128
- },
129
- // language=GraphQL
130
- mutation: `
131
- commentAdd(comment: CommentNew): Comment!
132
- commentUpdate(id: ID!, content: String!, related: NewCommentRelated): Comment!
133
- commentReportAbuse(id: ID!, relation: Relation!, reason: CommentReportReason!, content: String!): CommentReport
134
- commentLike(id: ID!, relation: Relation!): Comment
135
- commentRemove(id: ID!, relation: Relation!, authorId: ID!): CommentRemove
136
- commentBlock(id: ID!): Comment
137
- commentThreadBlock(id: ID!): Comment
138
- commentResolveReport(reportId: ID!, commentId: ID!): CommentReport
139
- `,
140
- resolver: {
141
- Query: {
142
- findAllInHierarchy: {
143
- resolverOf: 'plugins::comments.comments.findAllInHierarchy',
144
- resolver(obj, options) {
145
- const { relation, where } = options;
146
- return strapi.plugins.comments.services.comments.findAllInHierarchy({
147
- relation,
148
- where,
149
- dropBlockedThreads: true,
150
- });
151
- },
152
- },
153
- findAllFlat: {
154
- resolverOf: 'plugins::comments.comments.findAllFlat',
155
- resolver(obj, options) {
156
- const { relation, where } = options;
157
- return strapi.plugins.comments.services.comments.findAllFlat(relation, where);
158
- },
159
- },
160
- findAll: {
161
- resolverOf: 'plugins::comments.comments.findAll',
162
- resolver(obj, options) {
163
- const { related, entity, where } = options;
164
- return strapi.plugins.comments.services.comments.findAll({
165
- ...where,
166
- related,
167
- entity,
168
- });
169
- },
170
- },
171
- findOne: {
172
- resolverOf: 'plugins::comments.comments.findOne',
173
- resolver(obj, options) {
174
- const { id } = options;
175
- return strapi.plugins.comments.services.comments.findOneAndThread(id);
176
- },
177
- },
178
- config: {
179
- resolverOf: 'plugins::comments.comments.config',
180
- resolver(obj, options, { context }) {
181
- return strapi.plugins.comments.controllers.comments.config(context);
182
- },
183
- },
184
- contentTypeName: {
185
- resolverOf: 'plugins::comments.comments.contentTypeName',
186
- resolver(obj, options) {
187
- const { contentType } = options;
188
- return strapi.plugins.comments.services.comments.contentTypeName(contentType);
189
- },
190
- },
191
- },
192
- Mutation: {
193
- commentAdd: {
194
- resolverOf: 'plugins::comments.comments.post',
195
- policies: ['plugins::users-permissions.isAuthenticated'],
196
- resolver(obj, options, { context }) {
197
- const user = context.state.user;
198
- const { comment } = options;
199
- return strapi.plugins.comments.services.comments
200
- .create(comment, user);
201
- },
202
- },
203
- commentUpdate: {
204
- resolverOf: 'plugins::comments.comments.put',
205
- policies: ['plugins::users-permissions.isAuthenticated'],
206
- resolver(obj, options, { context }) {
207
- const user = context.state.user;
208
- const { id, ...data } = options;
209
- return strapi.plugins.comments.services.comments
210
- .update(id, data, user);
211
- },
212
- },
213
- commentReportAbuse: {
214
- resolverOf: 'plugins::comments.comments.reportAbuse',
215
- policies: ['plugins::users-permissions.isAuthenticated'],
216
- resolver(obj, options, { context }) {
217
- const user = context.state.user;
218
- const { id, relation, reason, content } = options;
219
- return strapi.plugins.comments.services.comments
220
- .reportAbuse(id, relation, { reason, content }, user);
221
- },
222
- },
223
- commentLike: {
224
- resolverOf: 'plugins::comments.comments.pointsUp',
225
- policies: ['plugins::users-permissions.isAuthenticated'],
226
- resolver(obj, options, { context }) {
227
- const user = context.state.user;
228
- const { id, relation } = options;
229
- return strapi.plugins.comments.services.comments
230
- .pointsUp(id, relation, user);
231
- },
232
- },
233
- commentRemove: {
234
- resolverOf: 'plugins::comments.comments.removeComment',
235
- resolver(obj, options) {
236
- const { id, relation, authorId } = options;
237
- return strapi.plugins.comments.services.comments
238
- .markAsRemoved(relation, id, authorId);
239
- },
240
- },
241
- commentBlock: {
242
- resolverOf: 'plugins::comments.comments.blockComment',
243
- resolver(obj, options) {
244
- const { id } = options;
245
- return strapi.plugins.comments.services.comments
246
- .blockComment(id);
247
- },
248
- },
249
- commentThreadBlock: {
250
- resolverOf: 'plugins::comments.comments.blockCommentThread',
251
- resolver(obj, options) {
252
- const { id } = options;
253
- return strapi.plugins.comments.services.comments
254
- .blockCommentThread(id);
255
- },
256
- },
257
- commentResolveReport: {
258
- resolverOf: 'plugins::comments.comments.resolveAbuseReport',
259
- resolver(obj, options) {
260
- const { reportId, commentId } = options;
261
- return strapi.plugins.comments.services.comments
262
- .resolveAbuseReport(reportId, commentId);
263
- },
264
- },
265
- },
266
- },
267
- };
268
-
@@ -1,228 +0,0 @@
1
- 'use strict';
2
-
3
- const { parseParams, throwError } = require('./utils/functions');
4
- const _ = require('lodash');
5
-
6
- /**
7
- * comments.js controller
8
- *
9
- * @description: A set of functions called "actions" of the `comments` plugin.
10
- */
11
-
12
- module.exports = {
13
-
14
- getService() {
15
- return strapi.plugins.comments.services.comments;
16
- },
17
-
18
- /**
19
- * Default action.
20
- *
21
- * @return {Object}
22
- */
23
- async findAll(ctx) {
24
- return strapi.plugins.comments.services.comments.findAll(ctx.query);
25
- },
26
-
27
- async findAllFlat(ctx) {
28
- const { params = {}, query } = ctx;
29
- const { relation } = parseParams(params);
30
- try {
31
- return await strapi.plugins.comments.services.comments.findAllFlat(relation, query);
32
- } catch (e) {
33
- throwError(ctx, e);
34
- }
35
- },
36
-
37
- async findAllInHierarchy(ctx) {
38
- const { params = {}, query } = ctx;
39
- const { relation } = parseParams(params);
40
- try {
41
- return await strapi.plugins.comments.services.comments.findAllInHierarchy({
42
- relation,
43
- query,
44
- dropBlockedThreads: true,
45
- });
46
- } catch (e) {
47
- throwError(ctx, e);
48
- }
49
- },
50
-
51
- async post(ctx) {
52
- const { request, state = {} } = ctx;
53
- const { user } = state;
54
- const { body = {} } = request;
55
- try {
56
- const entity = await strapi.plugins.comments.services.comments.create(body, user);
57
- if (entity) {
58
- return entity;
59
- }
60
- } catch (e) {
61
- throwError(ctx, e);
62
- }
63
- },
64
-
65
- async put(ctx) {
66
- const { request, state, params = {} } = ctx;
67
- const { body = {} } = request;
68
- const { user } = state;
69
- const { commentId } = parseParams(params);
70
- try {
71
- return await strapi.plugins.comments.services.comments.update(commentId, body, user);
72
- } catch (e) {
73
- throwError(ctx, e);
74
- }
75
- },
76
-
77
- async pointsUp(ctx) {
78
- const { state, params = {} } = ctx;
79
- const { user } = state;
80
- const { relation, commentId } = parseParams(params);
81
- try {
82
- return await strapi.plugins.comments.services.comments.pointsUp(commentId, relation, user);
83
- } catch (e) {
84
- throwError(ctx, e);
85
- }
86
- },
87
-
88
- async reportAbuse(ctx) {
89
- const { request, state, params = {} } = ctx;
90
- const { body = {} } = request;
91
- if (!body.content) {
92
- return ctx.badRequest(null, 'Content field is required');
93
- }
94
- const { user } = state;
95
- const { relation, commentId } = parseParams(params);
96
- try {
97
- return await strapi.plugins.comments.services.comments.reportAbuse(commentId, relation, body, user);
98
- } catch (e) {
99
- throwError(ctx, e);
100
- }
101
- },
102
-
103
- async removeComment(ctx) {
104
- const { params: { relationId, commentId }, query: { authorId } } = ctx;
105
- if (authorId) {
106
- try {
107
- return await this.getService().markAsRemoved(
108
- relationId,
109
- commentId,
110
- authorId,
111
- );
112
- } catch (e) {
113
- if (!e.isBoom) {
114
- throwError(ctx, e);
115
- }
116
- throw e;
117
- }
118
- }
119
- return ctx.badRequest('Not provided authorId');
120
- },
121
-
122
- //
123
- // Moderation
124
- //
125
-
126
- async findOne(ctx) {
127
- const { params = {} } = ctx;
128
- const { id } = parseParams(params);
129
- try {
130
- return await strapi.plugins.comments.services.comments.findOneAndThread(id);
131
- } catch (e) {
132
- throwError(ctx, e);
133
- }
134
- },
135
-
136
- async blockComment(ctx) {
137
- const { params = {} } = ctx;
138
- const { id } = parseParams(params);
139
- try {
140
- return await strapi.plugins.comments.services.comments.blockComment(id);
141
- } catch (e) {
142
- throwError(ctx, e);
143
- }
144
- },
145
-
146
- async blockCommentThread(ctx) {
147
- const { params = {} } = ctx;
148
- const { id } = parseParams(params);
149
- try {
150
- return await strapi.plugins.comments.services.comments.blockCommentThread(id);
151
- } catch (e) {
152
- throwError(ctx, e);
153
- }
154
- },
155
-
156
- async resolveAbuseReport(ctx) {
157
- const { params = {} } = ctx;
158
- const { id, commentId } = parseParams(params);
159
- try {
160
- return await strapi.plugins.comments.services.comments.resolveAbuseReport(id, commentId);
161
- } catch (e) {
162
- throwError(ctx, e);
163
- }
164
- },
165
-
166
- async approveComment(ctx) {
167
- const { id } = parseParams(ctx.params || {});
168
- try {
169
- return await strapi.plugins.comments.services.comments.approveComment(id);
170
- } catch (e) {
171
- throwError(ctx, e);
172
- }
173
- },
174
-
175
- async rejectComment(ctx) {
176
- const { id } = parseParams(ctx.params || {});
177
- try {
178
- return await strapi.plugins.comments.services.comments.rejectComment(id);
179
- } catch (e) {
180
- throwError(ctx, e);
181
- }
182
- },
183
- async config(ctx) {
184
- const configRelatedContentTypes = _.get(strapi.config, ['plugins', 'comments', 'relatedContentTypes'], {});
185
- const contentsTypes = this.getContentsTypes();
186
- const relatedContentTypes = Object
187
- .keys(configRelatedContentTypes)
188
- .reduce((acc, currentKey) => {
189
- const current = configRelatedContentTypes[currentKey];
190
- const { key } = contentsTypes.find(content => content.value === currentKey) || {};
191
- return {
192
- ...acc,
193
- [currentKey]: {
194
- ...current,
195
- globalName: _.snakeCase(key),
196
- },
197
- };
198
- },
199
- {},
200
- );
201
- return {
202
- relatedContentTypes,
203
- contentsTypes,
204
- };
205
- },
206
-
207
- getContentsTypes() {
208
- return Object.entries(strapi.contentTypes)
209
- .filter(([, contentType]) => (
210
- contentType.associations || []).some(_ => _.plugin === 'comments' && _.collection === 'comment'),
211
- )
212
- .reduce((acc, [, contentType]) => [
213
- ...acc,
214
- { key: contentType.globalName, value: contentType.collectionName }],
215
- [],
216
- );
217
- },
218
-
219
- async contentTypeName(ctx) {
220
- const { params: { contentTypeName } } = ctx;
221
- try {
222
- const result = await strapi.plugins.comments.services.comments.contentTypeName(contentTypeName);
223
- return { list: result };
224
- } catch (e) {
225
- throwError(ctx, e);
226
- }
227
- },
228
- };
package/models/comment.js DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/models.html#life-cycle-callbacks)
5
- * to customize this model
6
- */
7
-
8
- module.exports = {};
@@ -1,102 +0,0 @@
1
- {
2
- "collectionName": "comments",
3
- "info": {
4
- "name": "comment",
5
- "description": ""
6
- },
7
- "options": {
8
- "increments": true,
9
- "timestamps": true,
10
- "isManaged": false,
11
- "comment": ""
12
- },
13
- "pluginOptions": {
14
- "content-manager": {
15
- "visible": false
16
- },
17
- "content-type-builder": {
18
- "visible": false
19
- }
20
- },
21
- "attributes": {
22
- "content": {
23
- "type": "text",
24
- "configurable": false,
25
- "required": true
26
- },
27
- "blocked": {
28
- "type": "boolean",
29
- "default": false,
30
- "configurable": false
31
- },
32
- "blockedThread": {
33
- "type": "boolean",
34
- "default": false,
35
- "configurable": false
36
- },
37
- "blockReason": {
38
- "type": "string",
39
- "configurable": false
40
- },
41
- "points": {
42
- "type": "integer",
43
- "default": 0,
44
- "configurable": false
45
- },
46
- "authorUser": {
47
- "model": "user",
48
- "plugin": "users-permissions",
49
- "configurable": false
50
- },
51
- "authorType": {
52
- "type": "string",
53
- "configurable": false
54
- },
55
- "authorId": {
56
- "type": "string",
57
- "configurable": false
58
- },
59
- "authorName": {
60
- "type": "string",
61
- "configurable": false
62
- },
63
- "authorEmail": {
64
- "type": "email",
65
- "configurable": false
66
- },
67
- "authorAvatar": {
68
- "type": "string",
69
- "configurable": false
70
- },
71
- "removed": {
72
- "type": "boolean",
73
- "configurable": false
74
- },
75
- "relatedSlug": {
76
- "type": "string",
77
- "private": true,
78
- "configurable": false
79
- },
80
- "related": {
81
- "collection": "*",
82
- "filter": "field",
83
- "configurable": false
84
- },
85
- "reports": {
86
- "collection": "report",
87
- "plugin": "comments",
88
- "via": "related",
89
- "configurable": false
90
- },
91
- "threadOf": {
92
- "columnName": "threadOf",
93
- "model": "comment",
94
- "plugin": "comments",
95
- "configurable": false
96
- },
97
- "approvalStatus": {
98
- "type": "string",
99
- "configurable": false
100
- }
101
- }
102
- }
package/models/report.js DELETED
@@ -1,8 +0,0 @@
1
- 'use strict';
2
-
3
- /**
4
- * Read the documentation (https://strapi.io/documentation/3.0.0-beta.x/concepts/models.html#life-cycle-callbacks)
5
- * to customize this model
6
- */
7
-
8
- module.exports = {};
@@ -1,49 +0,0 @@
1
- {
2
- "collectionName": "comments_report",
3
- "info": {
4
- "name": "report",
5
- "description": ""
6
- },
7
- "options": {
8
- "increments": true,
9
- "timestamps": true,
10
- "isManaged": false,
11
- "comment": ""
12
- },
13
- "pluginOptions": {
14
- "content-manager": {
15
- "visible": false
16
- },
17
- "content-type-builder": {
18
- "visible": false
19
- }
20
- },
21
- "attributes": {
22
- "content": {
23
- "type": "text",
24
- "configurable": false
25
- },
26
- "reason": {
27
- "type": "enumeration",
28
- "enum": [
29
- "BAD_LANGUAGE",
30
- "DISCRIMINATION",
31
- "OTHER"
32
- ],
33
- "default": "OTHER",
34
- "configurable": false,
35
- "required": true
36
- },
37
- "resolved": {
38
- "type": "boolean",
39
- "default": false,
40
- "configurable": false
41
- },
42
- "related": {
43
- "fieldName": "related",
44
- "model": "comment",
45
- "plugin": "comments",
46
- "configurable": false
47
- }
48
- }
49
- }