strapi-plugin-comments 2.2.1 → 2.2.2-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.
- package/README.md +1 -1
- package/admin/src/components/ActionButton/styles.d.ts +1 -1
- package/admin/src/components/AdminAvatar/index.d.ts +4 -0
- package/admin/src/components/AdminAvatar/index.js +17 -0
- package/admin/src/components/AdminAvatar/styles.d.ts +3 -0
- package/admin/src/components/AdminAvatar/styles.js +17 -0
- package/admin/src/components/Avatar/index.d.ts +8 -11
- package/admin/src/components/Avatar/index.js +7 -8
- package/admin/src/components/DiscussionThreadItem/styles.d.ts +3 -3
- package/admin/src/components/DiscussionThreadItemActions/styles.d.ts +1 -1
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +1 -1
- package/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +2 -2
- package/admin/src/components/FormSwitch/styles.d.ts +1 -1
- package/admin/src/components/IconButton/styles.d.ts +1 -1
- package/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +2 -2
- package/admin/src/components/ModeratorResponse/styles.d.ts +1 -1
- package/admin/src/components/PreviewWysiwyg/Wrapper.d.ts +1 -1
- package/admin/src/components/StatusBadge/styles.d.ts +1 -1
- package/admin/src/components/Wysiwyg/EditorLayout.d.ts +1 -1
- package/admin/src/components/Wysiwyg/EditorStylesContainer.d.ts +1 -1
- package/admin/src/components/Wysiwyg/WysiwygStyles.d.ts +7 -7
- package/admin/src/components/icons/strapiIcons.d.ts +1 -0
- package/admin/src/components/icons/strapiIcons.js +2 -1
- package/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +1 -1
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +12 -11
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +1 -1
- package/admin/src/pages/Discover/utils/filtersSchema.d.ts +17 -2
- package/admin/src/pages/Discover/utils/filtersSchema.js +28 -0
- package/admin/src/pages/Reports/components/ReportsTableRow/styles.d.ts +1 -1
- package/admin/src/pages/Reports/utils/filtersSchema.d.ts +17 -2
- package/admin/src/pages/Reports/utils/filtersSchema.js +21 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +1 -1
- package/content-types/comment.d.ts +4 -0
- package/content-types/comment.js +4 -0
- package/content-types/index.d.ts +4 -0
- package/package.json +6 -4
- package/server/services/admin.js +3 -2
- package/server/services/client.js +4 -1
- package/server/services/utils/functions.d.ts +2 -1
- package/server/services/utils/functions.js +9 -1
- package/strapi-server.d.ts +4 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/types/contentTypes.d.ts +1 -0
package/README.md
CHANGED
|
@@ -134,7 +134,7 @@ In our minimum support we're following [official Node.js releases timelines](htt
|
|
|
134
134
|
|
|
135
135
|
**Supported Strapi versions**:
|
|
136
136
|
|
|
137
|
-
- Strapi v4.
|
|
137
|
+
- Strapi v4.5.2 (recently tested)
|
|
138
138
|
- Strapi v4.x
|
|
139
139
|
|
|
140
140
|
> 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).
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ActionButton: any
|
|
1
|
+
export declare const ActionButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
7
|
+
const styles_1 = require("./styles");
|
|
8
|
+
const icons_1 = require("@strapi/icons");
|
|
9
|
+
const Icon_1 = require("@strapi/design-system/Icon");
|
|
10
|
+
const AdminAvatar = ({ children }) => {
|
|
11
|
+
return (react_1.default.createElement(styles_1.AdminAvatarWrapper, null,
|
|
12
|
+
react_1.default.createElement(styles_1.AdminShield, null,
|
|
13
|
+
react_1.default.createElement(Icon_1.Icon, { as: icons_1.Shield, color: "neutral800" })),
|
|
14
|
+
children));
|
|
15
|
+
};
|
|
16
|
+
exports.default = AdminAvatar;
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export declare const AdminAvatarWrapper: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
|
+
export declare const AdminShield: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.AdminShield = exports.AdminAvatarWrapper = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const Box_1 = require("@strapi/design-system/Box");
|
|
9
|
+
exports.AdminAvatarWrapper = (0, styled_components_1.default)(Box_1.Box) `
|
|
10
|
+
position: relative;
|
|
11
|
+
`;
|
|
12
|
+
exports.AdminShield = (0, styled_components_1.default)(Box_1.Box) `
|
|
13
|
+
position: absolute;
|
|
14
|
+
right: -30%;
|
|
15
|
+
top: -30%;
|
|
16
|
+
`;
|
|
17
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
name: PropTypes.Requireable<string>;
|
|
10
|
-
};
|
|
11
|
-
};
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { ToBeFixed } from "../../../../types";
|
|
3
|
+
interface IProps {
|
|
4
|
+
avatar: string | ToBeFixed;
|
|
5
|
+
name: string;
|
|
6
|
+
isAdminComment?: boolean;
|
|
7
|
+
}
|
|
8
|
+
declare const UserAvatar: React.FC<IProps>;
|
|
12
9
|
export default UserAvatar;
|
|
13
10
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -4,23 +4,22 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
const react_1 = __importDefault(require("react"));
|
|
7
|
-
const prop_types_1 = __importDefault(require("prop-types"));
|
|
8
7
|
const lodash_1 = require("lodash");
|
|
9
8
|
const Avatar_1 = require("@strapi/design-system/Avatar");
|
|
10
9
|
const utils_1 = require("../../utils");
|
|
11
|
-
const
|
|
10
|
+
const AdminAvatar_1 = __importDefault(require("../AdminAvatar"));
|
|
11
|
+
;
|
|
12
|
+
const UserAvatar = ({ avatar, name, isAdminComment = false }) => {
|
|
12
13
|
if (avatar) {
|
|
13
14
|
let image = avatar;
|
|
14
15
|
if ((0, lodash_1.isObject)(avatar)) {
|
|
15
16
|
image = avatar?.formats?.thumbnail.url || avatar.url;
|
|
16
17
|
}
|
|
17
|
-
return image && (react_1.default.createElement(Avatar_1.Avatar, { src: image, alt: name }))
|
|
18
|
+
return (isAdminComment ? react_1.default.createElement(AdminAvatar_1.default, null, image && (react_1.default.createElement(Avatar_1.Avatar, { src: image, alt: name })))
|
|
19
|
+
: image && (react_1.default.createElement(Avatar_1.Avatar, { src: image, alt: name })));
|
|
18
20
|
}
|
|
19
|
-
return name && (react_1.default.createElement(Avatar_1.Initials, null, (0, utils_1.renderInitials)(name)))
|
|
20
|
-
|
|
21
|
-
UserAvatar.propTypes = {
|
|
22
|
-
avatar: prop_types_1.default.oneOfType(prop_types_1.default.string, prop_types_1.default.object).isRequired,
|
|
23
|
-
name: prop_types_1.default.string,
|
|
21
|
+
return (isAdminComment ? react_1.default.createElement(AdminAvatar_1.default, null, name && (react_1.default.createElement(Avatar_1.Initials, null, (0, utils_1.renderInitials)(name))))
|
|
22
|
+
: name && (react_1.default.createElement(Avatar_1.Initials, null, (0, utils_1.renderInitials)(name))));
|
|
24
23
|
};
|
|
25
24
|
exports.default = UserAvatar;
|
|
26
25
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const DiscussionThreadFullsize: any
|
|
2
|
-
export declare const DiscussionThreadItemContent: any
|
|
3
|
-
export declare const DiscussionThreadItemContainer: any
|
|
1
|
+
export declare const DiscussionThreadFullsize: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
|
+
export declare const DiscussionThreadItemContent: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
|
+
export declare const DiscussionThreadItemContainer: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
4
4
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DiscussionThreadItemActionsWrapper: any
|
|
1
|
+
export declare const DiscussionThreadItemActionsWrapper: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const DiscussionThreadItemActionsGroupWrapper: any
|
|
1
|
+
export declare const DiscussionThreadItemActionsGroupWrapper: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const DiscussionThreadItemFooterStyled: any
|
|
2
|
-
export declare const DiscussionThreadItemFooterMeta: any
|
|
1
|
+
export declare const DiscussionThreadItemFooterStyled: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
|
+
export declare const DiscussionThreadItemFooterMeta: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
3
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const StyledSwitch: any
|
|
1
|
+
export declare const StyledSwitch: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const IconButtonGroupStyled: any
|
|
1
|
+
export declare const IconButtonGroupStyled: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export declare const LoadingIndicatorOverlayWrapper: any
|
|
2
|
-
export declare const LoadingIndicatorContainer: any
|
|
1
|
+
export declare const LoadingIndicatorOverlayWrapper: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
|
+
export declare const LoadingIndicatorContainer: import("styled-components").StyledComponent<(props: any) => any, any, {}, never>;
|
|
3
3
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const ModeratorResponseStyled: any
|
|
1
|
+
export declare const ModeratorResponseStyled: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const StatusBadge: any
|
|
1
|
+
export declare const StatusBadge: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
export declare const ExpandButton: any
|
|
2
|
+
export declare const ExpandButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
3
|
declare type EditorLayoutProps = {
|
|
4
4
|
children: React.ReactNode;
|
|
5
5
|
error: string | undefined;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const EditorStylesContainer: any
|
|
1
|
+
export declare const EditorStylesContainer: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
2
2
|
//# sourceMappingURL=EditorStylesContainer.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export declare const CustomIconButton: any
|
|
2
|
-
export declare const CustomLinkIconButton: any
|
|
3
|
-
export declare const MainButtons: any
|
|
4
|
-
export declare const MoreButton: any
|
|
5
|
-
export declare const IconButtonGroupMargin: any
|
|
6
|
-
export declare const EditorAndPreviewWrapper: any
|
|
7
|
-
export declare const ExpandButton: any
|
|
1
|
+
export declare const CustomIconButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
|
+
export declare const CustomLinkIconButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
3
|
+
export declare const MainButtons: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
4
|
+
export declare const MoreButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
5
|
+
export declare const IconButtonGroupMargin: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
6
|
+
export declare const EditorAndPreviewWrapper: import("styled-components").StyledComponent<"div", any, {}, never>;
|
|
7
|
+
export declare const ExpandButton: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
8
8
|
//# sourceMappingURL=WysiwygStyles.d.ts.map
|
|
@@ -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.plus = exports.pencil = exports.trash = exports.comments = exports.unlock = exports.lock = exports.review = exports.refresh = exports.play = exports.information = exports.illo = exports.filter = exports.eye = exports.exclamationMarkCircle = exports.emptyPictures = exports.cross = exports.check = exports.carretDown = exports.arrowUp = exports.arrowRight = exports.arrowLeft = exports.apps = void 0;
|
|
6
|
+
exports.shield = exports.plus = exports.pencil = exports.trash = exports.comments = exports.unlock = exports.lock = exports.review = exports.refresh = exports.play = exports.information = exports.illo = exports.filter = exports.eye = exports.exclamationMarkCircle = exports.emptyPictures = exports.cross = exports.check = exports.carretDown = exports.arrowUp = exports.arrowRight = exports.arrowLeft = exports.apps = void 0;
|
|
7
7
|
const react_1 = __importDefault(require("react"));
|
|
8
8
|
const icons_1 = require("@strapi/icons");
|
|
9
9
|
const review_1 = __importDefault(require("./review"));
|
|
@@ -32,4 +32,5 @@ exports.comments = react_1.default.createElement(comments_1.default, null);
|
|
|
32
32
|
exports.trash = react_1.default.createElement(icons_1.Trash, null);
|
|
33
33
|
exports.pencil = react_1.default.createElement(icons_1.Pencil, null);
|
|
34
34
|
exports.plus = react_1.default.createElement(icons_1.Plus, null);
|
|
35
|
+
exports.shield = react_1.default.createElement(icons_1.Shield, null);
|
|
35
36
|
//# sourceMappingURL=strapiIcons.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TableLink: any
|
|
1
|
+
export declare const TableLink: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -47,24 +47,25 @@ const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAcce
|
|
|
47
47
|
if (reviewFlowEnabled || needsApproval) {
|
|
48
48
|
actionItemsCount = 2;
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
const { author, isAdminComment, id, content, threadOf, related, createdAt, updatedAt } = item;
|
|
51
|
+
return (react_1.default.createElement(Table_1.Tr, { key: id },
|
|
51
52
|
react_1.default.createElement(Table_1.Td, null,
|
|
52
53
|
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", fontWeight: "bold" },
|
|
53
54
|
"#",
|
|
54
|
-
|
|
55
|
+
id)),
|
|
55
56
|
react_1.default.createElement(Table_1.Td, null,
|
|
56
57
|
react_1.default.createElement(Stack_1.Stack, { size: 2, horizontal: true },
|
|
57
|
-
|
|
58
|
-
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", variant: "pi" },
|
|
58
|
+
author && (react_1.default.createElement(Avatar_1.default, { avatar: author.avatar, name: author.name, isAdminComment: isAdminComment })),
|
|
59
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", variant: "pi" }, author?.name || (0, utils_1.getMessage)('compontents.author.unknown')))),
|
|
59
60
|
react_1.default.createElement(Table_1.Td, { style: { maxWidth: "30vw" } },
|
|
60
|
-
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", ellipsis: true },
|
|
61
|
-
react_1.default.createElement(Table_1.Td, null,
|
|
61
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", ellipsis: true }, content)),
|
|
62
|
+
react_1.default.createElement(Table_1.Td, null, threadOf?.id ? (react_1.default.createElement(Link_1.Link, { to: renderDetailsUrl(threadOf) }, (0, utils_1.getMessage)({
|
|
62
63
|
id: "page.discover.table.cell.thread",
|
|
63
|
-
props: { id:
|
|
64
|
-
}, "#" +
|
|
65
|
-
react_1.default.createElement(Table_1.Td, { style: { maxWidth: "15vw" } },
|
|
64
|
+
props: { id: threadOf.id },
|
|
65
|
+
}, "#" + threadOf.id))) : ("-")),
|
|
66
|
+
react_1.default.createElement(Table_1.Td, { style: { maxWidth: "15vw" } }, related ? (react_1.default.createElement(styles_1.TableLink, { to: renderEntryUrl(related) }, (0, renderEntryTitle_1.default)(related, config))) : ("-")),
|
|
66
67
|
react_1.default.createElement(Table_1.Td, null,
|
|
67
|
-
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, formatDate(
|
|
68
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, formatDate(updatedAt || createdAt, {
|
|
68
69
|
dateStyle: "long",
|
|
69
70
|
timeStyle: "short",
|
|
70
71
|
}))),
|
|
@@ -73,7 +74,7 @@ const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAcce
|
|
|
73
74
|
react_1.default.createElement(Table_1.Td, null,
|
|
74
75
|
react_1.default.createElement(Flex_1.Flex, { direction: "column", alignItems: "flex-end" },
|
|
75
76
|
react_1.default.createElement(styles_2.IconButtonGroupStyled, { isSingle: !(reviewFlowEnabled || (canModerate && needsApproval)) },
|
|
76
|
-
canModerate && needsApproval && (react_1.default.createElement(DiscussionThreadItemApprovalFlowActions_1.default, { id:
|
|
77
|
+
canModerate && needsApproval && (react_1.default.createElement(DiscussionThreadItemApprovalFlowActions_1.default, { id: id, allowedActions: { canModerate } })),
|
|
77
78
|
react_1.default.createElement(DiscussionThreadItemReviewAction_1.default, { item: item, queryToInvalidate: "get-data", allowedActions: {
|
|
78
79
|
canModerate,
|
|
79
80
|
canAccessReports,
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TableLink: any
|
|
1
|
+
export declare const TableLink: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
declare const filtersSchema: {
|
|
1
|
+
declare const filtersSchema: ({
|
|
2
2
|
name: string;
|
|
3
3
|
metadatas: {
|
|
4
4
|
label: string;
|
|
5
5
|
};
|
|
6
6
|
fieldSchema: {
|
|
7
7
|
type: string;
|
|
8
|
+
mainField?: undefined;
|
|
8
9
|
};
|
|
9
|
-
}
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
metadatas: {
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
fieldSchema: {
|
|
16
|
+
type: string;
|
|
17
|
+
mainField: {
|
|
18
|
+
name: string;
|
|
19
|
+
schema: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
})[];
|
|
10
25
|
export default filtersSchema;
|
|
11
26
|
//# sourceMappingURL=filtersSchema.d.ts.map
|
|
@@ -6,6 +6,34 @@ const filtersSchema = [
|
|
|
6
6
|
metadatas: { label: "Message" },
|
|
7
7
|
fieldSchema: { type: "string" },
|
|
8
8
|
},
|
|
9
|
+
{
|
|
10
|
+
name: "createdAt",
|
|
11
|
+
metadatas: { label: "CreatedAt" },
|
|
12
|
+
fieldSchema: { type: "datetime" },
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
name: "updatedAt",
|
|
16
|
+
metadatas: { label: "UpdatedAt" },
|
|
17
|
+
fieldSchema: { type: "datetime" },
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
name: "authorName",
|
|
21
|
+
metadatas: { label: "Author" },
|
|
22
|
+
fieldSchema: { type: "string" },
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: "threadOf",
|
|
26
|
+
metadatas: { label: "threadOf" },
|
|
27
|
+
fieldSchema: {
|
|
28
|
+
type: "relation",
|
|
29
|
+
mainField: {
|
|
30
|
+
name: "id",
|
|
31
|
+
schema: {
|
|
32
|
+
type: "number"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
9
37
|
];
|
|
10
38
|
exports.default = filtersSchema;
|
|
11
39
|
//# sourceMappingURL=filtersSchema.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TableLink: any
|
|
1
|
+
export declare const TableLink: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1,11 +1,26 @@
|
|
|
1
|
-
declare const filtersSchema: {
|
|
1
|
+
declare const filtersSchema: ({
|
|
2
2
|
name: string;
|
|
3
3
|
metadatas: {
|
|
4
4
|
label: string;
|
|
5
5
|
};
|
|
6
6
|
fieldSchema: {
|
|
7
7
|
type: string;
|
|
8
|
+
mainField?: undefined;
|
|
8
9
|
};
|
|
9
|
-
}
|
|
10
|
+
} | {
|
|
11
|
+
name: string;
|
|
12
|
+
metadatas: {
|
|
13
|
+
label: string;
|
|
14
|
+
};
|
|
15
|
+
fieldSchema: {
|
|
16
|
+
type: string;
|
|
17
|
+
mainField: {
|
|
18
|
+
name: string;
|
|
19
|
+
schema: {
|
|
20
|
+
type: string;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
})[];
|
|
10
25
|
export default filtersSchema;
|
|
11
26
|
//# sourceMappingURL=filtersSchema.d.ts.map
|
|
@@ -6,6 +6,27 @@ const filtersSchema = [
|
|
|
6
6
|
metadatas: { label: 'Message' },
|
|
7
7
|
fieldSchema: { type: 'string' },
|
|
8
8
|
},
|
|
9
|
+
{
|
|
10
|
+
name: 'reason',
|
|
11
|
+
metadatas: { label: 'Reason' },
|
|
12
|
+
fieldSchema: { type: 'enum' },
|
|
13
|
+
}, {
|
|
14
|
+
name: 'resolved',
|
|
15
|
+
metadatas: { label: 'Resolved' },
|
|
16
|
+
fieldSchema: { type: 'boolean' },
|
|
17
|
+
}, {
|
|
18
|
+
name: 'related',
|
|
19
|
+
metadatas: { label: 'Comment author' },
|
|
20
|
+
fieldSchema: {
|
|
21
|
+
type: "relation",
|
|
22
|
+
mainField: {
|
|
23
|
+
name: "authorName",
|
|
24
|
+
schema: {
|
|
25
|
+
type: "string"
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
},
|
|
9
30
|
];
|
|
10
31
|
exports.default = filtersSchema;
|
|
11
32
|
//# sourceMappingURL=filtersSchema.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const RestartAlert: any
|
|
1
|
+
export declare const RestartAlert: import("styled-components").StyledComponent<any, any, object, string | number | symbol>;
|
|
2
2
|
//# sourceMappingURL=styles.d.ts.map
|
package/content-types/comment.js
CHANGED
package/content-types/index.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-comments",
|
|
3
|
-
"version": "2.2.1",
|
|
3
|
+
"version": "2.2.2-beta.1",
|
|
4
4
|
"description": "Strapi - Comments plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "comments",
|
|
@@ -14,12 +14,14 @@
|
|
|
14
14
|
"url": "https://github.com/VirtusLab-Open-Source/strapi-plugin-comments"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
|
-
"@strapi/plugin-graphql": "^4.
|
|
18
|
-
"@strapi/utils": "^4.
|
|
17
|
+
"@strapi/plugin-graphql": "^4.5.2",
|
|
18
|
+
"@strapi/utils": "^4.5.2",
|
|
19
19
|
"@types/axios": "^0.14.0",
|
|
20
20
|
"@types/react-intl": "^3.0.0",
|
|
21
21
|
"@types/react-query": "^1.2.9",
|
|
22
|
-
"
|
|
22
|
+
"@types/styled-components": "^5.1.26",
|
|
23
|
+
"bad-words": "^3.0.4",
|
|
24
|
+
"styled-components": "^5.3.6"
|
|
23
25
|
},
|
|
24
26
|
"devDependencies": {},
|
|
25
27
|
"peerDependencies": {
|
package/server/services/admin.js
CHANGED
|
@@ -450,11 +450,12 @@ module.exports = ({ strapi }) => ({
|
|
|
450
450
|
data: {
|
|
451
451
|
approvalStatus: "APPROVED",
|
|
452
452
|
authorId: author.id,
|
|
453
|
-
authorName: author
|
|
453
|
+
authorName: (0, functions_2.getAuthorName)(author),
|
|
454
454
|
authorEmail: author.email,
|
|
455
455
|
content: body,
|
|
456
456
|
threadOf: threadId,
|
|
457
|
-
related: entity.related
|
|
457
|
+
related: entity.related,
|
|
458
|
+
isAdminComment: true,
|
|
458
459
|
},
|
|
459
460
|
});
|
|
460
461
|
},
|
|
@@ -143,6 +143,9 @@ module.exports = ({ strapi }) => ({
|
|
|
143
143
|
id,
|
|
144
144
|
related: relation,
|
|
145
145
|
});
|
|
146
|
+
if (reportAgainstEntity.isAdminComment) {
|
|
147
|
+
throw new error_1.default(403, `You're not allowed to take an action on that entity. This in a admin comment.`);
|
|
148
|
+
}
|
|
146
149
|
if (reportAgainstEntity) {
|
|
147
150
|
const entity = await strapi.db
|
|
148
151
|
.query((0, functions_2.getModelUid)("comment-report"))
|
|
@@ -173,7 +176,7 @@ module.exports = ({ strapi }) => ({
|
|
|
173
176
|
throw new error_1.default(403, `You're not allowed to take an action on that entity. Make sure that comment exist or you've authenticated your request properly.`);
|
|
174
177
|
}
|
|
175
178
|
catch (e) {
|
|
176
|
-
throw
|
|
179
|
+
throw e;
|
|
177
180
|
}
|
|
178
181
|
},
|
|
179
182
|
async markAsRemoved(id, relation, authorId, user) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Id, StrapiUser } from "strapi-typed";
|
|
1
|
+
import { Id, StrapiAdmin, StrapiUser } from "strapi-typed";
|
|
2
2
|
import { Comment, ToBeFixed } from "../../../types";
|
|
3
3
|
import PluginError from "./../../utils/error";
|
|
4
4
|
export declare const buildNestedStructure: (entities: Array<Comment>, id?: Id | null, field?: string, dropBlockedThreads?: boolean, blockNestedThreads?: boolean) => Array<Comment>;
|
|
@@ -10,4 +10,5 @@ export declare const convertContentTypeNameToSlug: (str: string) => string;
|
|
|
10
10
|
export declare const buildAuthorModel: (item: Comment, fieldsToPopulate?: Array<string>) => Comment;
|
|
11
11
|
export declare const buildConfigQueryProp: (prop?: undefined | string | Array<string>) => string;
|
|
12
12
|
export declare const resolveUserContextError: (user: StrapiUser) => PluginError;
|
|
13
|
+
export declare const getAuthorName: (author: StrapiAdmin) => any;
|
|
13
14
|
//# sourceMappingURL=functions.d.ts.map
|
|
@@ -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.resolveUserContextError = exports.buildConfigQueryProp = exports.buildAuthorModel = exports.convertContentTypeNameToSlug = exports.filterOurResolvedReports = exports.getModelUid = exports.getRelatedGroups = exports.isEqualEntity = exports.buildNestedStructure = void 0;
|
|
6
|
+
exports.getAuthorName = exports.resolveUserContextError = exports.buildConfigQueryProp = exports.buildAuthorModel = exports.convertContentTypeNameToSlug = exports.filterOurResolvedReports = exports.getModelUid = exports.getRelatedGroups = exports.isEqualEntity = exports.buildNestedStructure = void 0;
|
|
7
7
|
const error_1 = __importDefault(require("./../../utils/error"));
|
|
8
8
|
const constants_1 = require("./../../utils/constants");
|
|
9
9
|
const lodash_1 = require("lodash");
|
|
@@ -105,4 +105,12 @@ const resolveUserContextError = (user) => {
|
|
|
105
105
|
}
|
|
106
106
|
};
|
|
107
107
|
exports.resolveUserContextError = resolveUserContextError;
|
|
108
|
+
const getAuthorName = (author) => {
|
|
109
|
+
const { lastname, username, firstname } = author;
|
|
110
|
+
if (lastname)
|
|
111
|
+
return `${firstname} ${lastname}`;
|
|
112
|
+
else
|
|
113
|
+
return username || firstname;
|
|
114
|
+
};
|
|
115
|
+
exports.getAuthorName = getAuthorName;
|
|
108
116
|
//# sourceMappingURL=functions.js.map
|