strapi-plugin-comments 2.1.7 → 2.2.0-beta.0
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 +11 -2
- package/admin/src/components/Avatar/index.d.ts +3 -2
- package/admin/src/components/Avatar/index.js +2 -2
- package/admin/src/components/CommentReviewModal/index.d.ts +11 -0
- package/admin/src/components/CommentReviewModal/index.js +19 -0
- package/admin/src/components/ConfirmationDialog/index.d.ts +12 -10
- package/admin/src/components/ConfirmationDialog/index.js +3 -3
- package/admin/src/components/DiscussionStatus/index.d.ts +2 -1
- package/admin/src/components/DiscussionThread/index.d.ts +11 -5
- package/admin/src/components/DiscussionThread/index.js +3 -3
- package/admin/src/components/DiscussionThreadItem/index.d.ts +2 -7
- package/admin/src/components/DiscussionThreadItem/index.js +3 -12
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +10 -6
- package/admin/src/components/DiscussionThreadItemActions/index.js +75 -53
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +9 -6
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +6 -9
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +14 -7
- package/admin/src/components/DiscussionThreadItemFooter/index.js +3 -3
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +14 -18
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +71 -52
- package/admin/src/components/FormSwitch/index.d.ts +2 -1
- package/admin/src/components/Hint/index.d.ts +14 -0
- package/admin/src/components/Hint/index.js +22 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +2 -1
- package/admin/src/components/ModeratorResponse/index.d.ts +8 -0
- package/admin/src/components/ModeratorResponse/index.js +108 -0
- package/admin/src/components/ModeratorResponse/styles.d.ts +2 -0
- package/admin/src/components/ModeratorResponse/styles.js +12 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.d.ts +11 -0
- package/admin/src/components/ModeratorResponseModal/ModeratorResponseModal.js +98 -0
- package/admin/src/components/Nav/index.d.ts +2 -1
- package/admin/src/components/Nav/index.js +6 -9
- package/admin/src/components/PluginIcon/index.d.ts +2 -1
- package/admin/src/components/PluginIcon/index.js +2 -6
- package/admin/src/components/PreviewWysiwyg/Wrapper.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/Wrapper.js +162 -0
- package/admin/src/components/PreviewWysiwyg/index.d.ts +7 -0
- package/admin/src/components/PreviewWysiwyg/index.js +39 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/mdRenderer.js +88 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.d.ts +3 -0
- package/admin/src/components/PreviewWysiwyg/utils/satinizeHtml.js +18 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.d.ts +16 -0
- package/admin/src/components/ReportsActions/components/BlockMenu/index.js +51 -0
- package/admin/src/components/ReportsActions/index.d.ts +12 -0
- package/admin/src/components/ReportsActions/index.js +31 -0
- package/admin/src/components/ReportsReviewModal/index.d.ts +14 -8
- package/admin/src/components/ReportsReviewTable/index.d.ts +13 -24
- package/admin/src/components/ReportsReviewTable/index.js +11 -24
- package/admin/src/components/StatusBadge/index.d.ts +2 -1
- package/admin/src/components/TableFilters/index.d.ts +12 -2
- package/admin/src/components/TableFilters/index.js +2 -2
- package/admin/src/components/TablePagination/index.d.ts +9 -2
- package/admin/src/components/Wysiwyg/Editor.d.ts +17 -0
- package/admin/src/components/Wysiwyg/Editor.js +84 -0
- package/admin/src/components/Wysiwyg/EditorLayout.d.ts +12 -0
- package/admin/src/components/Wysiwyg/EditorLayout.js +99 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +2 -0
- package/admin/src/components/Wysiwyg/EditorStylesContainer.js +348 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.d.ts +7 -0
- package/admin/src/components/Wysiwyg/WysiwygFooter.js +25 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.d.ts +13 -0
- package/admin/src/components/Wysiwyg/WysiwygNav.js +118 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +8 -0
- package/admin/src/components/Wysiwyg/WysiwygStyles.js +59 -0
- package/admin/src/components/Wysiwyg/index.d.ts +28 -0
- package/admin/src/components/Wysiwyg/index.js +136 -0
- package/admin/src/components/Wysiwyg/tests/index.test.d.ts +2 -0
- package/admin/src/components/Wysiwyg/tests/index.test.js +1633 -0
- package/admin/src/components/Wysiwyg/utils/continueList.d.ts +3 -0
- package/admin/src/components/Wysiwyg/utils/continueList.js +83 -0
- package/admin/src/components/Wysiwyg/utils/utils.d.ts +15 -0
- package/admin/src/components/Wysiwyg/utils/utils.js +249 -0
- package/admin/src/components/icons/comments.d.ts +2 -1
- package/admin/src/components/icons/index.d.ts +2 -5
- package/admin/src/components/icons/index.js +24 -12
- package/admin/src/components/icons/lock.d.ts +2 -1
- package/admin/src/components/icons/review.d.ts +2 -1
- package/admin/src/components/icons/strapiIcons.d.ts +24 -0
- package/admin/src/components/icons/strapiIcons.js +35 -0
- package/admin/src/components/icons/unlock.d.ts +2 -1
- package/admin/src/custom-fields/comments/components/icon.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/icon.js +14 -0
- package/admin/src/custom-fields/comments/components/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/index.js +19 -0
- package/admin/src/custom-fields/comments/components/input/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/components/input/index.js +5 -0
- package/admin/src/custom-fields/comments/components/input/input.d.ts +4 -0
- package/admin/src/custom-fields/comments/components/input/input.js +102 -0
- package/admin/src/custom-fields/comments/components/input/types.d.ts +10 -0
- package/admin/src/custom-fields/comments/components/input/types.js +3 -0
- package/admin/src/custom-fields/comments/components/input/utils.d.ts +35 -0
- package/admin/src/custom-fields/comments/components/input/utils.js +146 -0
- package/admin/src/custom-fields/comments/index.d.ts +3 -0
- package/admin/src/custom-fields/comments/index.js +53 -0
- package/admin/src/custom-fields/index.d.ts +3 -0
- package/admin/src/custom-fields/index.js +13 -0
- package/admin/src/hooks/useConfig.d.ts +4 -4
- package/admin/src/hooks/useConfig.js +3 -6
- package/admin/src/hooks/useReportsActionsHandlers.d.ts +19 -0
- package/admin/src/hooks/useReportsActionsHandlers.js +70 -0
- package/admin/src/index.d.ts +2 -1
- package/admin/src/index.js +4 -2
- package/admin/src/pages/App/index.js +8 -7
- package/admin/src/pages/App/reducer/index.d.ts +1 -1
- package/admin/src/pages/ComingSoonPage/index.d.ts +2 -1
- package/admin/src/pages/ComingSoonPage/index.js +2 -2
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +8 -6
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +5 -3
- package/admin/src/pages/Details/index.js +10 -7
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +11 -5
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +7 -81
- package/admin/src/pages/Discover/index.js +14 -13
- package/admin/src/pages/NoAccessPage/index.d.ts +4 -0
- package/admin/src/pages/NoAccessPage/index.js +31 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.d.ts +16 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/index.js +91 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.js +14 -0
- package/admin/src/pages/Reports/index.d.ts +4 -0
- package/admin/src/pages/Reports/index.js +196 -0
- package/admin/src/pages/Reports/utils/api.d.ts +2 -0
- package/admin/src/pages/Reports/utils/api.js +16 -0
- package/admin/src/pages/Reports/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Reports/utils/filtersSchema.js +11 -0
- package/admin/src/pages/Settings/index.d.ts +2 -1
- package/admin/src/pages/Settings/index.js +6 -7
- package/admin/src/pages/utils/api.d.ts +17 -10
- package/admin/src/pages/utils/api.js +25 -2
- package/admin/src/reducers.d.ts +1 -1
- package/admin/src/translations/en.json +49 -1
- package/admin/src/utils/axiosInstance.d.ts +1 -1
- package/admin/src/utils/constants.d.ts +9 -5
- package/admin/src/utils/constants.js +5 -3
- package/admin/src/utils/errors.d.ts +5 -0
- package/admin/src/utils/errors.js +10 -0
- package/admin/src/utils/functions.d.ts +2 -0
- package/admin/src/utils/functions.js +11 -0
- package/admin/src/utils/getMessage.d.ts +1 -1
- package/admin/src/utils/getMessage.js +1 -1
- package/admin/src/utils/getRelatedGroups.d.ts +6 -2
- package/admin/src/utils/handleAPIError.d.ts +1 -1
- package/admin/src/utils/index.d.ts +16 -11
- package/admin/src/utils/index.js +12 -1
- package/admin/src/utils/renderInitials.js +6 -5
- package/admin/src/utils/resolveCommentStatus.d.ts +8 -2
- package/admin/src/utils/resolveReportStatus.d.ts +4 -0
- package/admin/src/utils/resolveReportStatus.js +23 -0
- package/admin/src/utils/resolveReportStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveReportStatusColor.js +17 -0
- package/package.json +7 -4
- package/server/controllers/admin.js +67 -2
- package/server/index.d.ts +1 -1
- package/server/register/custom-fields/comments.d.ts +6 -0
- package/server/register/custom-fields/comments.js +9 -0
- package/server/register/custom-fields/index.d.ts +3 -0
- package/server/register/custom-fields/index.js +14 -0
- package/server/register/index.d.ts +4 -0
- package/server/register/index.js +8 -0
- package/server/routes/admin.js +56 -0
- package/server/services/admin.d.ts +1 -1
- package/server/services/admin.js +196 -10
- package/server/services/client.js +1 -1
- package/server/utils/error.js +1 -1
- package/strapi-server.d.ts +1 -1
- package/tsconfig.tsbuildinfo +1 -1
- package/types/utils.d.ts +5 -0
- package/types/utils.js +10 -0
- package/server/register.d.ts +0 -3
- package/server/register.js +0 -4
|
@@ -1,12 +1,17 @@
|
|
|
1
|
-
export { default as axiosInstance } from
|
|
2
|
-
export { default as getApiURL } from
|
|
3
|
-
export { default as getUrl } from
|
|
4
|
-
export { default as getMessage } from
|
|
5
|
-
export { default as handleAPIError } from
|
|
6
|
-
export { default as getRelatedGroups } from
|
|
7
|
-
export { default as renderEntryTitle } from
|
|
8
|
-
export { default as renderInitials } from
|
|
9
|
-
export { default as resolveCommentStatus } from
|
|
10
|
-
export { default as resolveCommentStatusColor } from
|
|
11
|
-
export { default as
|
|
1
|
+
export { default as axiosInstance } from './axiosInstance';
|
|
2
|
+
export { default as getApiURL } from './getApiUrl';
|
|
3
|
+
export { default as getUrl } from './getUrl';
|
|
4
|
+
export { default as getMessage } from './getMessage';
|
|
5
|
+
export { default as handleAPIError } from './handleAPIError';
|
|
6
|
+
export { default as getRelatedGroups } from './getRelatedGroups';
|
|
7
|
+
export { default as renderEntryTitle } from './renderEntryTitle';
|
|
8
|
+
export { default as renderInitials } from './renderInitials';
|
|
9
|
+
export { default as resolveCommentStatus } from './resolveCommentStatus';
|
|
10
|
+
export { default as resolveCommentStatusColor } from './resolveCommentStatusColor';
|
|
11
|
+
export { default as resolveReportStatus } from './resolveReportStatus';
|
|
12
|
+
export { default as resolveReportStatusColor } from './resolveReportStatusColor';
|
|
13
|
+
export { default as parseRegExp } from './parseRegExp';
|
|
14
|
+
export { APPROVAL_STATUS } from './constants';
|
|
15
|
+
export { UIError, ValidationError } from './errors';
|
|
16
|
+
export { assertString } from './functions';
|
|
12
17
|
//# sourceMappingURL=index.d.ts.map
|
package/admin/src/utils/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.parseRegExp = exports.resolveCommentStatusColor = exports.resolveCommentStatus = exports.renderInitials = exports.renderEntryTitle = exports.getRelatedGroups = exports.handleAPIError = exports.getMessage = exports.getUrl = exports.getApiURL = exports.axiosInstance = void 0;
|
|
6
|
+
exports.assertString = exports.ValidationError = exports.UIError = exports.APPROVAL_STATUS = exports.parseRegExp = exports.resolveReportStatusColor = exports.resolveReportStatus = exports.resolveCommentStatusColor = exports.resolveCommentStatus = exports.renderInitials = exports.renderEntryTitle = exports.getRelatedGroups = exports.handleAPIError = exports.getMessage = exports.getUrl = exports.getApiURL = exports.axiosInstance = void 0;
|
|
7
7
|
var axiosInstance_1 = require("./axiosInstance");
|
|
8
8
|
Object.defineProperty(exports, "axiosInstance", { enumerable: true, get: function () { return __importDefault(axiosInstance_1).default; } });
|
|
9
9
|
var getApiUrl_1 = require("./getApiUrl");
|
|
@@ -24,6 +24,17 @@ var resolveCommentStatus_1 = require("./resolveCommentStatus");
|
|
|
24
24
|
Object.defineProperty(exports, "resolveCommentStatus", { enumerable: true, get: function () { return __importDefault(resolveCommentStatus_1).default; } });
|
|
25
25
|
var resolveCommentStatusColor_1 = require("./resolveCommentStatusColor");
|
|
26
26
|
Object.defineProperty(exports, "resolveCommentStatusColor", { enumerable: true, get: function () { return __importDefault(resolveCommentStatusColor_1).default; } });
|
|
27
|
+
var resolveReportStatus_1 = require("./resolveReportStatus");
|
|
28
|
+
Object.defineProperty(exports, "resolveReportStatus", { enumerable: true, get: function () { return __importDefault(resolveReportStatus_1).default; } });
|
|
29
|
+
var resolveReportStatusColor_1 = require("./resolveReportStatusColor");
|
|
30
|
+
Object.defineProperty(exports, "resolveReportStatusColor", { enumerable: true, get: function () { return __importDefault(resolveReportStatusColor_1).default; } });
|
|
27
31
|
var parseRegExp_1 = require("./parseRegExp");
|
|
28
32
|
Object.defineProperty(exports, "parseRegExp", { enumerable: true, get: function () { return __importDefault(parseRegExp_1).default; } });
|
|
33
|
+
var constants_1 = require("./constants");
|
|
34
|
+
Object.defineProperty(exports, "APPROVAL_STATUS", { enumerable: true, get: function () { return constants_1.APPROVAL_STATUS; } });
|
|
35
|
+
var errors_1 = require("./errors");
|
|
36
|
+
Object.defineProperty(exports, "UIError", { enumerable: true, get: function () { return errors_1.UIError; } });
|
|
37
|
+
Object.defineProperty(exports, "ValidationError", { enumerable: true, get: function () { return errors_1.ValidationError; } });
|
|
38
|
+
var functions_1 = require("./functions");
|
|
39
|
+
Object.defineProperty(exports, "assertString", { enumerable: true, get: function () { return functions_1.assertString; } });
|
|
29
40
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const lodash_1 = require("lodash");
|
|
4
|
-
const renderInitials = (value = "") => value
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
const renderInitials = (value = "") => (0, lodash_1.isString)(value) ?
|
|
5
|
+
value
|
|
6
|
+
.split(" ")
|
|
7
|
+
.map((_) => (0, lodash_1.first)(_))
|
|
8
|
+
.join("")
|
|
9
|
+
.toUpperCase() : "";
|
|
9
10
|
exports.default = renderInitials;
|
|
10
11
|
//# sourceMappingURL=renderInitials.js.map
|
|
@@ -1,4 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
declare type Config = {
|
|
2
|
+
removed?: boolean;
|
|
3
|
+
blocked?: boolean;
|
|
4
|
+
blockedThread?: boolean;
|
|
5
|
+
approvalStatus?: string;
|
|
6
|
+
reviewFlowEnabled?: boolean;
|
|
7
|
+
};
|
|
8
|
+
declare const resolveCommentStatus: ({ removed, blocked, blockedThread, approvalStatus, reviewFlowEnabled, }: Config) => string;
|
|
3
9
|
export default resolveCommentStatus;
|
|
4
10
|
//# sourceMappingURL=resolveCommentStatus.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const lodash_1 = require("lodash");
|
|
4
|
+
const constants_1 = require("./constants");
|
|
5
|
+
const resolveReportStatus = ({ resolved, related: { blocked, blockedThread }, approvalStatus, }) => {
|
|
6
|
+
const gotApprovalFlow = !(0, lodash_1.isNil)(approvalStatus);
|
|
7
|
+
if (blocked || blockedThread) {
|
|
8
|
+
return constants_1.REPORT_STATUS.BLOCKED;
|
|
9
|
+
}
|
|
10
|
+
if (resolved) {
|
|
11
|
+
return constants_1.REPORT_STATUS.RESOLVED;
|
|
12
|
+
}
|
|
13
|
+
if (gotApprovalFlow) {
|
|
14
|
+
const status = approvalStatus.toUpperCase();
|
|
15
|
+
if (Object.keys(constants_1.REPORT_STATUS).includes(status)) {
|
|
16
|
+
return status;
|
|
17
|
+
}
|
|
18
|
+
return constants_1.REPORT_STATUS.PENDING;
|
|
19
|
+
}
|
|
20
|
+
return constants_1.REPORT_STATUS.PENDING;
|
|
21
|
+
};
|
|
22
|
+
exports.default = resolveReportStatus;
|
|
23
|
+
//# sourceMappingURL=resolveReportStatus.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const constants_1 = require("./constants");
|
|
4
|
+
const resolveReportStatusColor = (status) => {
|
|
5
|
+
switch (status) {
|
|
6
|
+
case constants_1.REPORT_STATUS.PENDING:
|
|
7
|
+
return "primary";
|
|
8
|
+
case constants_1.REPORT_STATUS.RESOLVED:
|
|
9
|
+
return "success";
|
|
10
|
+
case constants_1.REPORT_STATUS.BLOCKED:
|
|
11
|
+
return "danger";
|
|
12
|
+
default:
|
|
13
|
+
return "primary";
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
exports.default = resolveReportStatusColor;
|
|
17
|
+
//# sourceMappingURL=resolveReportStatusColor.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-comments",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.2.0-beta.0",
|
|
4
4
|
"description": "Strapi - Comments plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "comments",
|
|
@@ -14,8 +14,11 @@
|
|
|
14
14
|
"url": "https://github.com/VirtusLab-Open-Source/strapi-plugin-comments"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@strapi/
|
|
18
|
-
"@strapi/
|
|
17
|
+
"@strapi/plugin-graphql": "^4.3.8",
|
|
18
|
+
"@strapi/utils": "^4.3.8",
|
|
19
|
+
"@types/axios": "^0.14.0",
|
|
20
|
+
"@types/react-intl": "^3.0.0",
|
|
21
|
+
"@types/react-query": "^1.2.9",
|
|
19
22
|
"bad-words": "^3.0.4"
|
|
20
23
|
},
|
|
21
24
|
"devDependencies": {},
|
|
@@ -53,7 +56,7 @@
|
|
|
53
56
|
}
|
|
54
57
|
],
|
|
55
58
|
"engines": {
|
|
56
|
-
"node": ">=14.
|
|
59
|
+
"node": ">=14.19.1 <=17.x.x",
|
|
57
60
|
"npm": ">=7.x.x"
|
|
58
61
|
},
|
|
59
62
|
"keywords": [
|
|
@@ -52,6 +52,9 @@ const controllers = {
|
|
|
52
52
|
async findAll(ctx) {
|
|
53
53
|
return this.getService().findAll(ctx.query);
|
|
54
54
|
},
|
|
55
|
+
async findReports(ctx) {
|
|
56
|
+
return this.getService().findReports(ctx.query);
|
|
57
|
+
},
|
|
55
58
|
async findOne(ctx) {
|
|
56
59
|
const { params = {}, query } = ctx;
|
|
57
60
|
const { id } = (0, functions_2.parseParams)(params);
|
|
@@ -82,6 +85,16 @@ const controllers = {
|
|
|
82
85
|
throw (0, functions_2.throwError)(ctx, e);
|
|
83
86
|
}
|
|
84
87
|
},
|
|
88
|
+
async deleteComment(ctx) {
|
|
89
|
+
const { params = {} } = ctx;
|
|
90
|
+
const { id } = (0, functions_2.parseParams)(params);
|
|
91
|
+
try {
|
|
92
|
+
return await this.getService().deleteComment(id);
|
|
93
|
+
}
|
|
94
|
+
catch (e) {
|
|
95
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
96
|
+
}
|
|
97
|
+
},
|
|
85
98
|
async blockCommentThread(ctx) {
|
|
86
99
|
const { params = {} } = ctx;
|
|
87
100
|
const { id } = (0, functions_2.parseParams)(params);
|
|
@@ -112,13 +125,65 @@ const controllers = {
|
|
|
112
125
|
throw (0, functions_2.throwError)(ctx, e);
|
|
113
126
|
}
|
|
114
127
|
},
|
|
115
|
-
async
|
|
128
|
+
async resolveCommentMultipleAbuseReports(ctx) {
|
|
116
129
|
const { params = {}, request } = ctx;
|
|
117
130
|
const { body } = request;
|
|
118
131
|
const { id: commentId } = (0, functions_2.parseParams)(params);
|
|
119
132
|
(0, functions_1.assertNotEmpty)(body);
|
|
120
133
|
try {
|
|
121
|
-
return await this.getService().
|
|
134
|
+
return await this.getService().resolveCommentMultipleAbuseReports(body, commentId);
|
|
135
|
+
}
|
|
136
|
+
catch (e) {
|
|
137
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
138
|
+
}
|
|
139
|
+
},
|
|
140
|
+
async resolveAllAbuseReportsForComment(ctx) {
|
|
141
|
+
const { params } = ctx;
|
|
142
|
+
const { id: commentId } = (0, functions_2.parseParams)(params);
|
|
143
|
+
try {
|
|
144
|
+
return await this.getService().resolveAllAbuseReportsForComment(commentId);
|
|
145
|
+
}
|
|
146
|
+
catch (e) {
|
|
147
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
148
|
+
}
|
|
149
|
+
},
|
|
150
|
+
async resolveAllAbuseReportsForThread(ctx) {
|
|
151
|
+
const { params } = ctx;
|
|
152
|
+
const { id: commentId } = (0, functions_2.parseParams)(params);
|
|
153
|
+
try {
|
|
154
|
+
return await this.getService().resolveAllAbuseReportsForThread(commentId);
|
|
155
|
+
}
|
|
156
|
+
catch (e) {
|
|
157
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
158
|
+
}
|
|
159
|
+
},
|
|
160
|
+
async resolveMultipleAbuseReports(ctx) {
|
|
161
|
+
const { request: { body }, } = ctx;
|
|
162
|
+
(0, functions_1.assertNotEmpty)(body);
|
|
163
|
+
try {
|
|
164
|
+
return await this.getService().resolveMultipleAbuseReports(body);
|
|
165
|
+
}
|
|
166
|
+
catch (e) {
|
|
167
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
async postComment(ctx) {
|
|
171
|
+
const { params = {}, request } = ctx;
|
|
172
|
+
const { body } = request;
|
|
173
|
+
const { id: threadId } = (0, functions_2.parseParams)(params);
|
|
174
|
+
try {
|
|
175
|
+
return await this.getService().postComment(threadId, body.content, body.author);
|
|
176
|
+
}
|
|
177
|
+
catch (e) {
|
|
178
|
+
throw (0, functions_2.throwError)(ctx, e);
|
|
179
|
+
}
|
|
180
|
+
},
|
|
181
|
+
async updateComment(ctx) {
|
|
182
|
+
const { params = {}, request } = ctx;
|
|
183
|
+
const { body } = request;
|
|
184
|
+
const { id } = (0, functions_2.parseParams)(params);
|
|
185
|
+
try {
|
|
186
|
+
return await this.getService().updateComment(id, body.content);
|
|
122
187
|
}
|
|
123
188
|
catch (e) {
|
|
124
189
|
throw (0, functions_2.throwError)(ctx, e);
|
package/server/index.d.ts
CHANGED
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerCustomFields = void 0;
|
|
4
|
+
const comments_1 = require("./comments");
|
|
5
|
+
const registerCustomFields = ({ strapi }) => {
|
|
6
|
+
if (!canRegister({ strapi })) {
|
|
7
|
+
strapi.log.warn("[Comments Plugin] Custom fields disabled. Upgrade Strapi to use custom fields.");
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
strapi.customFields.register(comments_1.commentsCustomField);
|
|
11
|
+
};
|
|
12
|
+
exports.registerCustomFields = registerCustomFields;
|
|
13
|
+
const canRegister = ({ strapi }) => !!strapi.customFields;
|
|
14
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const custom_fields_1 = require("./custom-fields");
|
|
4
|
+
const register = (context) => {
|
|
5
|
+
(0, custom_fields_1.registerCustomFields)(context);
|
|
6
|
+
};
|
|
7
|
+
exports.default = register;
|
|
8
|
+
//# sourceMappingURL=index.js.map
|
package/server/routes/admin.js
CHANGED
|
@@ -17,6 +17,14 @@ const routes = [
|
|
|
17
17
|
policies: [],
|
|
18
18
|
},
|
|
19
19
|
},
|
|
20
|
+
{
|
|
21
|
+
method: "GET",
|
|
22
|
+
path: "/moderate/reports",
|
|
23
|
+
handler: "admin.findReports",
|
|
24
|
+
config: {
|
|
25
|
+
policies: [],
|
|
26
|
+
},
|
|
27
|
+
},
|
|
20
28
|
{
|
|
21
29
|
method: "GET",
|
|
22
30
|
path: "/moderate/single/:id",
|
|
@@ -57,6 +65,14 @@ const routes = [
|
|
|
57
65
|
policies: [],
|
|
58
66
|
},
|
|
59
67
|
},
|
|
68
|
+
{
|
|
69
|
+
method: "DELETE",
|
|
70
|
+
path: "/moderate/single/:id/delete",
|
|
71
|
+
handler: "admin.deleteComment",
|
|
72
|
+
config: {
|
|
73
|
+
policies: [],
|
|
74
|
+
},
|
|
75
|
+
},
|
|
60
76
|
{
|
|
61
77
|
method: "PATCH",
|
|
62
78
|
path: "/moderate/single/:id/report/:reportId/resolve",
|
|
@@ -68,11 +84,43 @@ const routes = [
|
|
|
68
84
|
{
|
|
69
85
|
method: "PUT",
|
|
70
86
|
path: "/moderate/single/:id/report/resolve",
|
|
87
|
+
handler: "admin.resolveCommentMultipleAbuseReports",
|
|
88
|
+
config: {
|
|
89
|
+
policies: [],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
method: "PUT",
|
|
94
|
+
path: "/moderate/all/:id/report/resolve",
|
|
95
|
+
handler: "admin.resolveAllAbuseReportsForComment",
|
|
96
|
+
config: {
|
|
97
|
+
policies: [],
|
|
98
|
+
},
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
method: "PUT",
|
|
102
|
+
path: "/moderate/all/:id/report/resolve-thread",
|
|
103
|
+
handler: "admin.resolveAllAbuseReportsForThread",
|
|
104
|
+
config: {
|
|
105
|
+
policies: [],
|
|
106
|
+
},
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
method: "PUT",
|
|
110
|
+
path: "/moderate/multiple/report/resolve",
|
|
71
111
|
handler: "admin.resolveMultipleAbuseReports",
|
|
72
112
|
config: {
|
|
73
113
|
policies: [],
|
|
74
114
|
},
|
|
75
115
|
},
|
|
116
|
+
{
|
|
117
|
+
method: "PUT",
|
|
118
|
+
path: "/moderate/single/:id/update",
|
|
119
|
+
handler: "admin.updateComment",
|
|
120
|
+
config: {
|
|
121
|
+
policies: [],
|
|
122
|
+
},
|
|
123
|
+
},
|
|
76
124
|
{
|
|
77
125
|
method: "PATCH",
|
|
78
126
|
path: "/moderate/thread/:id/block",
|
|
@@ -89,6 +137,14 @@ const routes = [
|
|
|
89
137
|
policies: [],
|
|
90
138
|
},
|
|
91
139
|
},
|
|
140
|
+
{
|
|
141
|
+
method: "POST",
|
|
142
|
+
path: "/moderate/thread/:id/postComment",
|
|
143
|
+
handler: "admin.postComment",
|
|
144
|
+
config: {
|
|
145
|
+
policies: [],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
92
148
|
{
|
|
93
149
|
method: "GET",
|
|
94
150
|
path: "/settings/config",
|