strapi-plugin-comments 2.1.8 → 2.2.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 -3
- package/admin/src/components/Avatar/index.d.ts +3 -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/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 +6 -3
- 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/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,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from "prop-types";
|
|
1
3
|
declare const DetailsEntity: {
|
|
2
4
|
({ data, schema, config, filters, onFiltersChange, }: {
|
|
3
5
|
data?: {} | undefined;
|
|
@@ -5,13 +7,13 @@ declare const DetailsEntity: {
|
|
|
5
7
|
config?: {} | undefined;
|
|
6
8
|
filters: any;
|
|
7
9
|
onFiltersChange: any;
|
|
8
|
-
}):
|
|
10
|
+
}): JSX.Element;
|
|
9
11
|
propTypes: {
|
|
10
|
-
data:
|
|
11
|
-
schema:
|
|
12
|
-
config:
|
|
13
|
-
filters:
|
|
14
|
-
onFiltersChange: any
|
|
12
|
+
data: PropTypes.Validator<object>;
|
|
13
|
+
schema: PropTypes.Validator<object>;
|
|
14
|
+
config: PropTypes.Validator<object>;
|
|
15
|
+
filters: PropTypes.Validator<object>;
|
|
16
|
+
onFiltersChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
15
17
|
};
|
|
16
18
|
};
|
|
17
19
|
export default DetailsEntity;
|
|
@@ -1,11 +1,13 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from "prop-types";
|
|
1
3
|
declare const DetailsFilters: {
|
|
2
4
|
({ data, onChange }: {
|
|
3
5
|
data: any;
|
|
4
6
|
onChange: any;
|
|
5
|
-
}):
|
|
7
|
+
}): JSX.Element;
|
|
6
8
|
propTypes: {
|
|
7
|
-
data:
|
|
8
|
-
onChange: any
|
|
9
|
+
data: PropTypes.Validator<object>;
|
|
10
|
+
onChange: PropTypes.Validator<(...args: any[]) => any>;
|
|
9
11
|
};
|
|
10
12
|
};
|
|
11
13
|
export default DetailsFilters;
|
|
@@ -37,7 +37,7 @@ const Layout_1 = require("@strapi/design-system/Layout");
|
|
|
37
37
|
const Box_1 = require("@strapi/design-system/Box");
|
|
38
38
|
const Link_1 = require("@strapi/design-system/Link");
|
|
39
39
|
const LiveRegions_1 = require("@strapi/design-system/LiveRegions");
|
|
40
|
-
const icons_1 = require("
|
|
40
|
+
const icons_1 = require("../../components/icons");
|
|
41
41
|
const lodash_1 = require("lodash");
|
|
42
42
|
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
43
43
|
const getMessage_1 = __importDefault(require("../../utils/getMessage"));
|
|
@@ -47,6 +47,7 @@ const utils_1 = require("../../utils");
|
|
|
47
47
|
const DetailsEntity_1 = __importDefault(require("./components/DetailsEntity"));
|
|
48
48
|
const DiscussionThread_1 = __importDefault(require("../../components/DiscussionThread"));
|
|
49
49
|
const selectors_1 = __importDefault(require("../App/reducer/selectors"));
|
|
50
|
+
const index_1 = __importDefault(require("../../components/ModeratorResponse/index"));
|
|
50
51
|
const Details = ({ config }) => {
|
|
51
52
|
(0, helper_plugin_1.useFocusWhenNavigate)();
|
|
52
53
|
const { params: { id }, } = (0, react_router_dom_1.useRouteMatch)((0, utils_1.getUrl)(`discover/:id`));
|
|
@@ -77,13 +78,15 @@ const Details = ({ config }) => {
|
|
|
77
78
|
if (canAccess) {
|
|
78
79
|
return (react_1.default.createElement(Box_1.Box, { background: "neutral100" },
|
|
79
80
|
react_1.default.createElement(Layout_1.Layout, null, (isLoading || isLoadingForPermissions) && (0, lodash_1.isEmpty)(data) ? (react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
80
|
-
react_1.default.createElement(Layout_1.HeaderLayout, { navigationAction: react_1.default.createElement(Link_1.Link, { startIcon:
|
|
81
|
+
react_1.default.createElement(Layout_1.HeaderLayout, { navigationAction: react_1.default.createElement(Link_1.Link, { startIcon: icons_1.arrowLeft, to: (0, utils_1.getUrl)(`discover`) }, (0, getMessage_1.default)("HeaderLayout.link.go-back", "Back", false)), title: (0, getMessage_1.default)("page.details.header"), subtitle: (0, getMessage_1.default)("page.details.header.description"), as: "h2" }),
|
|
81
82
|
react_1.default.createElement(Layout_1.ContentLayout, null,
|
|
82
|
-
react_1.default.createElement(Layout_1.TwoColsLayout, { startCol: react_1.default.createElement(
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
react_1.default.createElement(Layout_1.TwoColsLayout, { startCol: react_1.default.createElement(react_1.default.Fragment, null,
|
|
84
|
+
react_1.default.createElement(DiscussionThread_1.default, { level: level, selected: selected, isReloading: isLoading, allowedActions: {
|
|
85
|
+
canModerate,
|
|
86
|
+
canAccessReports,
|
|
87
|
+
canReviewReports,
|
|
88
|
+
} }),
|
|
89
|
+
selected?.threadOf && (react_1.default.createElement(index_1.default, { rootThread: { ...selected.threadOf } }))), endCol: react_1.default.createElement(DetailsEntity_1.default, { data: entity, schema: contentTypeData?.schema, config: config, filters: filters, onFiltersChange: handleChangeFilters }) })))))));
|
|
87
90
|
}
|
|
88
91
|
return null;
|
|
89
92
|
};
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import PropTypes from "prop-types";
|
|
1
3
|
declare const DiscoverTableRow: {
|
|
2
4
|
({ config, item, allowedActions: { canModerate, canAccessReports, canReviewReports }, onClick, }: {
|
|
3
5
|
config: any;
|
|
@@ -8,12 +10,16 @@ declare const DiscoverTableRow: {
|
|
|
8
10
|
canReviewReports: any;
|
|
9
11
|
};
|
|
10
12
|
onClick: any;
|
|
11
|
-
}):
|
|
13
|
+
}): JSX.Element;
|
|
12
14
|
propTypes: {
|
|
13
|
-
config:
|
|
14
|
-
item:
|
|
15
|
-
allowedActions:
|
|
16
|
-
|
|
15
|
+
config: PropTypes.Validator<object>;
|
|
16
|
+
item: PropTypes.Validator<object>;
|
|
17
|
+
allowedActions: PropTypes.Requireable<PropTypes.InferProps<{
|
|
18
|
+
canModerate: PropTypes.Requireable<boolean>;
|
|
19
|
+
canAccessReports: PropTypes.Requireable<boolean>;
|
|
20
|
+
canReviewReports: PropTypes.Requireable<boolean>;
|
|
21
|
+
}>>;
|
|
22
|
+
onClick: PropTypes.Validator<(...args: any[]) => any>;
|
|
17
23
|
};
|
|
18
24
|
};
|
|
19
25
|
export default DiscoverTableRow;
|
|
@@ -1,35 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
4
|
};
|
|
28
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
const react_1 =
|
|
6
|
+
const react_1 = __importDefault(require("react"));
|
|
30
7
|
const prop_types_1 = __importDefault(require("prop-types"));
|
|
31
8
|
const react_intl_1 = require("react-intl");
|
|
32
|
-
const react_query_1 = require("react-query");
|
|
33
9
|
const lodash_1 = require("lodash");
|
|
34
10
|
const Flex_1 = require("@strapi/design-system/Flex");
|
|
35
11
|
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
@@ -37,11 +13,8 @@ const Link_1 = require("@strapi/design-system/Link");
|
|
|
37
13
|
const Stack_1 = require("@strapi/design-system/Stack");
|
|
38
14
|
const Table_1 = require("@strapi/design-system/Table");
|
|
39
15
|
const Typography_1 = require("@strapi/design-system/Typography");
|
|
40
|
-
const icons_1 = require("@strapi/icons");
|
|
41
|
-
const helper_plugin_1 = require("@strapi/helper-plugin");
|
|
42
16
|
const utils_1 = require("../../../../utils");
|
|
43
|
-
const
|
|
44
|
-
const pluginId_1 = require("../../../../pluginId");
|
|
17
|
+
const icons_1 = require("../../../../components/icons");
|
|
45
18
|
const styles_1 = require("./styles");
|
|
46
19
|
const renderEntryTitle_1 = __importDefault(require("../../../../utils/renderEntryTitle"));
|
|
47
20
|
const DiscussionThreadItemApprovalFlowActions_1 = __importDefault(require("../../../../components/DiscussionThreadItemApprovalFlowActions"));
|
|
@@ -50,59 +23,12 @@ const styles_2 = require("../../../../components/IconButton/styles");
|
|
|
50
23
|
const DiscussionThreadItemReviewAction_1 = __importDefault(require("../../../../components/DiscussionThreadItemReviewAction"));
|
|
51
24
|
const Avatar_1 = __importDefault(require("../../../../components/Avatar"));
|
|
52
25
|
const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAccessReports, canReviewReports }, onClick, }) => {
|
|
53
|
-
const {
|
|
54
|
-
const [blockButtonsDisabled, setBlockButtonsDisabled] = (0, react_1.useState)(false);
|
|
26
|
+
const { reports } = item;
|
|
55
27
|
const { formatDate } = (0, react_intl_1.useIntl)();
|
|
56
|
-
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
57
|
-
const queryClient = (0, react_query_1.useQueryClient)();
|
|
58
|
-
const { lockApp, unlockApp } = (0, helper_plugin_1.useOverlayBlocker)();
|
|
59
|
-
const onSuccess = (message, stateAction = () => { }, indalidate = true) => async () => {
|
|
60
|
-
if (indalidate) {
|
|
61
|
-
await queryClient.invalidateQueries("get-data");
|
|
62
|
-
}
|
|
63
|
-
toggleNotification({
|
|
64
|
-
type: "success",
|
|
65
|
-
message: `${pluginId_1.pluginId}.${message}`,
|
|
66
|
-
});
|
|
67
|
-
stateAction(false);
|
|
68
|
-
unlockApp();
|
|
69
|
-
};
|
|
70
|
-
const onError = (err) => {
|
|
71
|
-
(0, utils_1.handleAPIError)(err, toggleNotification);
|
|
72
|
-
};
|
|
73
|
-
const blockItemMutation = (0, react_query_1.useMutation)(api_1.blockItem, {
|
|
74
|
-
onSuccess: onSuccess("page.details.actions.comment.block.confirmation.success"),
|
|
75
|
-
onError,
|
|
76
|
-
refetchActive: false,
|
|
77
|
-
});
|
|
78
|
-
const blockItemThreadMutation = (0, react_query_1.useMutation)(api_1.blockItemThread, {
|
|
79
|
-
onSuccess: onSuccess("page.details.actions.thread.block.confirmation.success"),
|
|
80
|
-
onError,
|
|
81
|
-
refetchActive: false,
|
|
82
|
-
});
|
|
83
|
-
const handleBlockItemClick = async () => {
|
|
84
|
-
if (canModerate) {
|
|
85
|
-
lockApp();
|
|
86
|
-
blockItemMutation.mutate(id);
|
|
87
|
-
}
|
|
88
|
-
};
|
|
89
|
-
const handleBlockItemThreadClick = async () => {
|
|
90
|
-
if (canModerate) {
|
|
91
|
-
lockApp();
|
|
92
|
-
blockItemThreadMutation.mutate(id);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
const handleBlockActionClick = async (mutation, onCallback) => {
|
|
96
|
-
lockApp();
|
|
97
|
-
await mutation.mutateAsync(id);
|
|
98
|
-
onCallback();
|
|
99
|
-
};
|
|
100
|
-
const isLoading = blockItemMutation.isLoading || blockItemThreadMutation.isLoading;
|
|
101
28
|
const openReports = reports?.filter((_) => !_.resolved);
|
|
102
29
|
const hasReports = !(0, lodash_1.isEmpty)(openReports);
|
|
103
30
|
const reviewFlowEnabled = canAccessReports && hasReports && !(item.blocked || item.blockedThread);
|
|
104
31
|
const handleClick = () => onClick();
|
|
105
|
-
const handleBlockButtonsStateChange = (disabled) => setBlockButtonsDisabled(disabled);
|
|
106
32
|
const renderStatus = (props) => {
|
|
107
33
|
const status = (0, utils_1.resolveCommentStatus)({ ...props, reviewFlowEnabled });
|
|
108
34
|
const color = (0, utils_1.resolveCommentStatusColor)(status);
|
|
@@ -147,13 +73,13 @@ const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAcce
|
|
|
147
73
|
react_1.default.createElement(Table_1.Td, null,
|
|
148
74
|
react_1.default.createElement(Flex_1.Flex, { direction: "column", alignItems: "flex-end" },
|
|
149
75
|
react_1.default.createElement(styles_2.IconButtonGroupStyled, { isSingle: !(reviewFlowEnabled || (canModerate && needsApproval)) },
|
|
150
|
-
canModerate && needsApproval && (react_1.default.createElement(DiscussionThreadItemApprovalFlowActions_1.default, { id: item.id, allowedActions: { canModerate }
|
|
151
|
-
react_1.default.createElement(DiscussionThreadItemReviewAction_1.default, { item: item, queryToInvalidate: "get-data",
|
|
76
|
+
canModerate && needsApproval && (react_1.default.createElement(DiscussionThreadItemApprovalFlowActions_1.default, { id: item.id, allowedActions: { canModerate } })),
|
|
77
|
+
react_1.default.createElement(DiscussionThreadItemReviewAction_1.default, { item: item, queryToInvalidate: "get-data", allowedActions: {
|
|
152
78
|
canModerate,
|
|
153
79
|
canAccessReports,
|
|
154
80
|
canReviewReports,
|
|
155
|
-
}
|
|
156
|
-
react_1.default.createElement(IconButton_1.IconButton, { onClick: handleClick, label: (0, utils_1.getMessage)("page.discover.table.action.display"), icon:
|
|
81
|
+
} }),
|
|
82
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: handleClick, label: (0, utils_1.getMessage)("page.discover.table.action.display"), icon: icons_1.eye }))))));
|
|
157
83
|
};
|
|
158
84
|
DiscoverTableRow.propTypes = {
|
|
159
85
|
config: prop_types_1.default.object.isRequired,
|
|
@@ -45,11 +45,14 @@ const getMessage_1 = __importDefault(require("../../utils/getMessage"));
|
|
|
45
45
|
const api_1 = require("./utils/api");
|
|
46
46
|
const permissions_1 = __importDefault(require("../../permissions"));
|
|
47
47
|
const getUrl_1 = __importDefault(require("../../utils/getUrl"));
|
|
48
|
+
const Nav_1 = __importDefault(require("../../components/Nav"));
|
|
48
49
|
const TablePagination_1 = __importDefault(require("../../components/TablePagination"));
|
|
49
50
|
const filtersSchema_1 = __importDefault(require("./utils/filtersSchema"));
|
|
50
51
|
const TableFilters_1 = __importDefault(require("../../components/TableFilters"));
|
|
51
52
|
const selectors_1 = __importDefault(require("../App/reducer/selectors"));
|
|
52
53
|
const DiscoverTableRow_1 = __importDefault(require("./components/DiscoverTableRow"));
|
|
54
|
+
const NoAccessPage_1 = __importDefault(require("../NoAccessPage"));
|
|
55
|
+
const COL_COUNT = 8;
|
|
53
56
|
const Discover = ({ config }) => {
|
|
54
57
|
(0, helper_plugin_1.useFocusWhenNavigate)();
|
|
55
58
|
const { push } = (0, react_router_dom_1.useHistory)();
|
|
@@ -58,7 +61,7 @@ const Discover = ({ config }) => {
|
|
|
58
61
|
const trackUsageRef = (0, react_1.useRef)(trackUsage);
|
|
59
62
|
const toggleNotification = (0, helper_plugin_1.useNotification)();
|
|
60
63
|
const [{ query: queryParams }] = (0, helper_plugin_1.useQueryParams)();
|
|
61
|
-
const _q = queryParams?._q ||
|
|
64
|
+
const _q = queryParams?._q || '';
|
|
62
65
|
const viewPermissions = (0, react_1.useMemo)(() => ({
|
|
63
66
|
access: permissions_1.default.access,
|
|
64
67
|
moderate: permissions_1.default.moderate,
|
|
@@ -66,7 +69,7 @@ const Discover = ({ config }) => {
|
|
|
66
69
|
reviewReports: permissions_1.default.reportsReview,
|
|
67
70
|
}), []);
|
|
68
71
|
const { isLoading: isLoadingForPermissions, allowedActions: { canAccess, canModerate, canAccessReports, canReviewReports, }, } = (0, helper_plugin_1.useRBAC)(viewPermissions);
|
|
69
|
-
const { isLoading: isLoadingForData, data: { result, pagination = {} }, isFetching, } = (0, react_query_1.useQuery)([
|
|
72
|
+
const { isLoading: isLoadingForData, data: { result, pagination = {} }, isFetching, } = (0, react_query_1.useQuery)(['get-data', queryParams, canAccess], () => (0, api_1.fetchData)(queryParams, toggleNotification), {
|
|
70
73
|
initialData: {},
|
|
71
74
|
});
|
|
72
75
|
const handleClickDisplay = (id) => {
|
|
@@ -76,19 +79,18 @@ const Discover = ({ config }) => {
|
|
|
76
79
|
const { total } = pagination;
|
|
77
80
|
const emptyLayout = {
|
|
78
81
|
comments: {
|
|
79
|
-
id: (0, getMessage_1.default)(
|
|
82
|
+
id: (0, getMessage_1.default)('page.discover.table.empty'),
|
|
80
83
|
defaultMessage: "You don't have any comments yet.",
|
|
81
84
|
},
|
|
82
85
|
search: {
|
|
83
|
-
id: (0, getMessage_1.default)(
|
|
84
|
-
defaultMessage:
|
|
86
|
+
id: (0, getMessage_1.default)('page.discover.table.empty.search'),
|
|
87
|
+
defaultMessage: 'No comments match the search.',
|
|
85
88
|
},
|
|
86
89
|
};
|
|
87
|
-
const emptyContent = _q ?
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
react_1.default.createElement(Layout_1.Layout, null, isLoading || isLoadingForPermissions ? (react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null)) : (react_1.default.createElement(react_1.default.Fragment, null,
|
|
90
|
+
const emptyContent = _q ? 'search' : 'comments';
|
|
91
|
+
return canAccess ? (react_1.default.createElement(Box_1.Box, { background: "neutral100" },
|
|
92
|
+
react_1.default.createElement(Layout_1.Layout, null, isLoading || isLoadingForPermissions ? (react_1.default.createElement(helper_plugin_1.LoadingIndicatorPage, null)) : (react_1.default.createElement(Layout_1.Layout, { sideNav: react_1.default.createElement(Nav_1.default, { visible: true }) },
|
|
93
|
+
react_1.default.createElement(react_1.default.Fragment, null,
|
|
92
94
|
react_1.default.createElement(Layout_1.HeaderLayout, { title: (0, getMessage_1.default)("page.discover.header"), subtitle: `${total} ${(0, getMessage_1.default)("page.discover.header.count")}`, as: "h2" }),
|
|
93
95
|
react_1.default.createElement(Layout_1.ActionLayout, { startActions: react_1.default.createElement(react_1.default.Fragment, null,
|
|
94
96
|
react_1.default.createElement(helper_plugin_1.SearchURLQuery, { label: (0, getMessage_1.default)("search.label", "Search", false) }),
|
|
@@ -118,9 +120,8 @@ const Discover = ({ config }) => {
|
|
|
118
120
|
canAccessReports,
|
|
119
121
|
canReviewReports,
|
|
120
122
|
}, onClick: () => handleClickDisplay(entry.id) }))))),
|
|
121
|
-
react_1.default.createElement(TablePagination_1.default, { pagination: { pageCount: pagination?.pageCount || 1 } }))) : (react_1.default.createElement(helper_plugin_1.EmptyStateLayout, { content: emptyLayout[emptyContent] }))))))))
|
|
122
|
-
|
|
123
|
-
return null;
|
|
123
|
+
react_1.default.createElement(TablePagination_1.default, { pagination: { pageCount: pagination?.pageCount || 1 } }))) : (react_1.default.createElement(helper_plugin_1.EmptyStateLayout, { content: emptyLayout[emptyContent] }))))))))) :
|
|
124
|
+
react_1.default.createElement(NoAccessPage_1.default, null);
|
|
124
125
|
};
|
|
125
126
|
const mapStateToProps = (0, selectors_1.default)();
|
|
126
127
|
function mapDispatchToProps(dispatch) {
|
|
@@ -0,0 +1,31 @@
|
|
|
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 helper_plugin_1 = require("@strapi/helper-plugin");
|
|
8
|
+
const Main_1 = require("@strapi/design-system/Main");
|
|
9
|
+
const Layout_1 = require("@strapi/design-system/Layout");
|
|
10
|
+
const EmptyStateLayout_1 = require("@strapi/design-system/EmptyStateLayout");
|
|
11
|
+
const icons_1 = require("../../components/icons");
|
|
12
|
+
const react_intl_1 = require("react-intl");
|
|
13
|
+
const NoAcccessPage = () => {
|
|
14
|
+
const { formatMessage } = (0, react_intl_1.useIntl)();
|
|
15
|
+
(0, helper_plugin_1.useFocusWhenNavigate)();
|
|
16
|
+
return (react_1.default.createElement(Main_1.Main, { labelledBy: "title" },
|
|
17
|
+
react_1.default.createElement(Layout_1.HeaderLayout, { id: "title", title: formatMessage({
|
|
18
|
+
id: 'page.auth.noAccess',
|
|
19
|
+
defaultMessage: 'No access',
|
|
20
|
+
}) }),
|
|
21
|
+
react_1.default.createElement(Layout_1.ContentLayout, null,
|
|
22
|
+
react_1.default.createElement(EmptyStateLayout_1.EmptyStateLayout, { action: react_1.default.createElement(helper_plugin_1.LinkButton, { variant: "secondary", endIcon: icons_1.arrowRight, to: "/" }, formatMessage({
|
|
23
|
+
id: 'components.notAccessPage.back',
|
|
24
|
+
defaultMessage: 'Back to homepage',
|
|
25
|
+
})), content: formatMessage({
|
|
26
|
+
id: 'page.auth.not.allowed',
|
|
27
|
+
defaultMessage: "Oops! It seems like You do not have access to this page...",
|
|
28
|
+
}), hasRadius: true, icon: icons_1.emptyPictures, shadow: "tableShadow" }))));
|
|
29
|
+
};
|
|
30
|
+
exports.default = NoAcccessPage;
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
declare const ReportsTableRow: ({ allowedActions, config, handleItemSelectionChange, isChecked, item, mutation, onClick, onSelectionChange, reports, selectedReports, updateReports, }: {
|
|
3
|
+
allowedActions: any;
|
|
4
|
+
config: any;
|
|
5
|
+
handleItemSelectionChange: any;
|
|
6
|
+
isChecked: any;
|
|
7
|
+
item: any;
|
|
8
|
+
mutation: any;
|
|
9
|
+
onClick: any;
|
|
10
|
+
onSelectionChange: any;
|
|
11
|
+
reports: any;
|
|
12
|
+
selectedReports: any;
|
|
13
|
+
updateReports: any;
|
|
14
|
+
}) => JSX.Element;
|
|
15
|
+
export default ReportsTableRow;
|
|
16
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
const BaseCheckbox_1 = require("@strapi/design-system/BaseCheckbox");
|
|
30
|
+
const Button_1 = require("@strapi/design-system/Button");
|
|
31
|
+
const Table_1 = require("@strapi/design-system/Table");
|
|
32
|
+
const Typography_1 = require("@strapi/design-system/Typography");
|
|
33
|
+
;
|
|
34
|
+
const icons_1 = require("../../../../components/icons");
|
|
35
|
+
const react_1 = __importStar(require("react"));
|
|
36
|
+
const react_intl_1 = require("react-intl");
|
|
37
|
+
const CommentReviewModal_1 = __importDefault(require("../../../../components/CommentReviewModal"));
|
|
38
|
+
const StatusBadge_1 = __importDefault(require("../../../../components/StatusBadge"));
|
|
39
|
+
const utils_1 = require("../../../../utils");
|
|
40
|
+
const ReportsActions_1 = __importDefault(require("../../../../components/ReportsActions"));
|
|
41
|
+
const cellMaxWidth = { maxWidth: "30vw" };
|
|
42
|
+
const ReportsTableRow = ({ allowedActions, config, handleItemSelectionChange, isChecked, item, mutation, onClick, onSelectionChange, reports, selectedReports, updateReports, }) => {
|
|
43
|
+
const { reports: reportedReports, } = item;
|
|
44
|
+
const [modalVisible, setModalVisible] = (0, react_1.useState)(false);
|
|
45
|
+
const { formatDate } = (0, react_intl_1.useIntl)();
|
|
46
|
+
const openReports = reportedReports?.filter((_) => !_.resolved);
|
|
47
|
+
const handleOpenModal = (0, react_1.useCallback)(() => {
|
|
48
|
+
setModalVisible(true);
|
|
49
|
+
}, [setModalVisible]);
|
|
50
|
+
const handleCloseModal = (0, react_1.useCallback)(() => {
|
|
51
|
+
setModalVisible(false);
|
|
52
|
+
}, [setModalVisible]);
|
|
53
|
+
const renderStatus = (props) => {
|
|
54
|
+
const status = (0, utils_1.resolveReportStatus)(props);
|
|
55
|
+
const color = (0, utils_1.resolveReportStatusColor)(status);
|
|
56
|
+
return (react_1.default.createElement(StatusBadge_1.default, { backgroundColor: `${color}100`, textColor: `${color}700`, color: color }, (0, utils_1.getMessage)({
|
|
57
|
+
id: `page.common.item.status.${status}`,
|
|
58
|
+
props: {
|
|
59
|
+
count: openReports.length,
|
|
60
|
+
},
|
|
61
|
+
}, status)));
|
|
62
|
+
};
|
|
63
|
+
return (react_1.default.createElement(Table_1.Tr, { key: item.id },
|
|
64
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
65
|
+
react_1.default.createElement(BaseCheckbox_1.BaseCheckbox, { "aria-label": (0, utils_1.getMessage)("page.details.panel.discussion.warnings.reports.dialog.select"), value: isChecked(item.id), onValueChange: (value) => handleItemSelectionChange(item.id, value) })),
|
|
66
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
67
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", fontWeight: "bold" },
|
|
68
|
+
"#",
|
|
69
|
+
item.id)),
|
|
70
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
71
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", variant: "pi" }, item.reason || (0, utils_1.getMessage)("compontents.reason.unknown"))),
|
|
72
|
+
react_1.default.createElement(Table_1.Td, { style: cellMaxWidth },
|
|
73
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", ellipsis: true }, item.content || (0, utils_1.getMessage)("compontents.content.unknown"))),
|
|
74
|
+
react_1.default.createElement(Table_1.Td, { style: cellMaxWidth },
|
|
75
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", ellipsis: true }, renderStatus(item))),
|
|
76
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
77
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, formatDate(item.updatedAt || item.createdAt, {
|
|
78
|
+
dateStyle: "long",
|
|
79
|
+
timeStyle: "short",
|
|
80
|
+
}))),
|
|
81
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
82
|
+
react_1.default.createElement(Button_1.Button, { variant: "tertiary", startIcon: icons_1.eye, onClick: handleOpenModal }, (0, utils_1.getMessage)({
|
|
83
|
+
id: "page.discover.table.cell.thread",
|
|
84
|
+
props: { id: item.related.id },
|
|
85
|
+
}, `#${item.related.id}`)),
|
|
86
|
+
react_1.default.createElement(CommentReviewModal_1.default, { isVisible: modalVisible, onClose: handleCloseModal, item: item })),
|
|
87
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
88
|
+
react_1.default.createElement(ReportsActions_1.default, { item: item, allowedActions: allowedActions, mutation: mutation, reports: reports, updateReports: updateReports, onSelectionChange: onSelectionChange, selectedReports: selectedReports }))));
|
|
89
|
+
};
|
|
90
|
+
exports.default = ReportsTableRow;
|
|
91
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,14 @@
|
|
|
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.TableLink = void 0;
|
|
7
|
+
const styled_components_1 = __importDefault(require("styled-components"));
|
|
8
|
+
const Link_1 = require("@strapi/design-system/Link");
|
|
9
|
+
exports.TableLink = (0, styled_components_1.default)(Link_1.Link) `
|
|
10
|
+
display: block;
|
|
11
|
+
text-overflow: ellipsis;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
`;
|
|
14
|
+
//# sourceMappingURL=styles.js.map
|