strapi-plugin-comments 2.0.10 → 2.1.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 +204 -124
- package/admin/src/components/ActionButton/styles.d.ts +2 -0
- package/admin/src/components/ActionButton/styles.js +13 -8
- package/admin/src/components/Avatar/index.d.ts +12 -0
- package/admin/src/components/Avatar/index.js +26 -0
- package/admin/src/components/ConfirmationDialog/index.d.ts +26 -0
- package/admin/src/components/ConfirmationDialog/index.js +36 -55
- package/admin/src/components/DiscussionStatus/index.d.ts +9 -0
- package/admin/src/components/DiscussionStatus/index.js +22 -31
- package/admin/src/components/DiscussionThread/index.d.ts +16 -0
- package/admin/src/components/DiscussionThread/index.js +39 -56
- package/admin/src/components/DiscussionThreadItem/index.d.ts +9 -0
- package/admin/src/components/DiscussionThreadItem/index.js +28 -52
- package/admin/src/components/DiscussionThreadItem/styles.d.ts +4 -0
- package/admin/src/components/DiscussionThreadItem/styles.js +16 -11
- package/admin/src/components/DiscussionThreadItemActions/index.d.ts +19 -0
- package/admin/src/components/DiscussionThreadItemActions/index.js +121 -158
- package/admin/src/components/DiscussionThreadItemActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemActions/styles.js +13 -7
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +17 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.js +38 -48
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +2 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +12 -6
- package/admin/src/components/DiscussionThreadItemFooter/index.d.ts +16 -0
- package/admin/src/components/DiscussionThreadItemFooter/index.js +34 -42
- package/admin/src/components/DiscussionThreadItemFooter/styles.d.ts +3 -0
- package/admin/src/components/DiscussionThreadItemFooter/styles.js +17 -12
- package/admin/src/components/DiscussionThreadItemReviewAction/index.d.ts +30 -0
- package/admin/src/components/DiscussionThreadItemReviewAction/index.js +77 -91
- package/admin/src/components/FormSwitch/index.d.ts +7 -0
- package/admin/src/components/FormSwitch/index.js +15 -18
- package/admin/src/components/FormSwitch/styles.d.ts +2 -0
- package/admin/src/components/FormSwitch/styles.js +14 -8
- package/admin/src/components/IconButton/styles.d.ts +2 -0
- package/admin/src/components/IconButton/styles.js +16 -9
- package/admin/src/components/Initializer/index.d.ts +5 -0
- package/admin/src/components/Initializer/index.js +12 -24
- package/admin/src/components/LoadingIndicatorOverlay/index.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.js +12 -15
- package/admin/src/components/LoadingIndicatorOverlay/styles.d.ts +3 -0
- package/admin/src/components/LoadingIndicatorOverlay/styles.js +22 -17
- package/admin/src/components/Nav/index.d.ts +7 -0
- package/admin/src/components/Nav/index.js +25 -48
- package/admin/src/components/PluginIcon/index.d.ts +3 -0
- package/admin/src/components/PluginIcon/index.js +10 -12
- package/admin/src/components/ReportsReviewModal/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewModal/index.js +31 -46
- package/admin/src/components/ReportsReviewTable/index.d.ts +21 -0
- package/admin/src/components/ReportsReviewTable/index.js +120 -140
- package/admin/src/components/StatusBadge/index.d.ts +7 -0
- package/admin/src/components/StatusBadge/index.js +12 -17
- package/admin/src/components/StatusBadge/styles.d.ts +2 -0
- package/admin/src/components/StatusBadge/styles.js +19 -13
- package/admin/src/components/TableFilters/index.d.ts +10 -0
- package/admin/src/components/TableFilters/index.js +52 -49
- package/admin/src/components/TablePagination/index.d.ts +17 -0
- package/admin/src/components/TablePagination/index.js +27 -29
- package/admin/src/components/icons/comments.d.ts +6 -0
- package/admin/src/components/icons/comments.js +11 -8
- package/admin/src/components/icons/index.d.ts +6 -0
- package/admin/src/components/icons/index.js +15 -6
- package/admin/src/components/icons/lock.d.ts +7 -0
- package/admin/src/components/icons/lock.js +11 -21
- package/admin/src/components/icons/review.d.ts +7 -0
- package/admin/src/components/icons/review.js +11 -17
- package/admin/src/components/icons/unlock.d.ts +7 -0
- package/admin/src/components/icons/unlock.js +11 -19
- package/admin/src/hooks/useConfig.d.ts +8 -0
- package/admin/src/hooks/useConfig.js +40 -45
- package/admin/src/index.d.ts +7 -0
- package/admin/src/index.js +98 -92
- package/admin/src/pages/App/index.d.ts +4 -0
- package/admin/src/pages/App/index.js +43 -67
- package/admin/src/pages/App/reducer/actions.d.ts +8 -0
- package/admin/src/pages/App/reducer/actions.js +11 -7
- package/admin/src/pages/App/reducer/constants.d.ts +4 -0
- package/admin/src/pages/App/reducer/constants.js +7 -4
- package/admin/src/pages/App/reducer/index.d.ts +9 -0
- package/admin/src/pages/App/reducer/index.js +24 -22
- package/admin/src/pages/App/reducer/init.d.ts +3 -0
- package/admin/src/pages/App/reducer/init.js +6 -4
- package/admin/src/pages/App/reducer/selectors.d.ts +6 -0
- package/admin/src/pages/App/reducer/selectors.js +17 -34
- package/admin/src/pages/App/utils/api.d.ts +2 -0
- package/admin/src/pages/App/utils/api.js +14 -11
- package/admin/src/pages/ComingSoonPage/index.d.ts +3 -0
- package/admin/src/pages/ComingSoonPage/index.js +42 -24
- package/admin/src/pages/Details/components/DetailsEntity/index.d.ts +18 -0
- package/admin/src/pages/Details/components/DetailsEntity/index.js +49 -77
- package/admin/src/pages/Details/components/DetailsFilters/index.d.ts +12 -0
- package/admin/src/pages/Details/components/DetailsFilters/index.js +19 -26
- package/admin/src/pages/Details/components/DetailsFilters/styles.d.ts +2 -0
- package/admin/src/pages/Details/components/DetailsFilters/styles.js +14 -8
- package/admin/src/pages/Details/index.d.ts +4 -0
- package/admin/src/pages/Details/index.js +94 -133
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.d.ts +20 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.js +128 -139
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +2 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.js +14 -8
- package/admin/src/pages/Discover/index.d.ts +4 -0
- package/admin/src/pages/Discover/index.js +129 -170
- package/admin/src/pages/Discover/utils/api.d.ts +2 -0
- package/admin/src/pages/Discover/utils/api.js +15 -13
- package/admin/src/pages/Discover/utils/filtersSchema.d.ts +11 -0
- package/admin/src/pages/Discover/utils/filtersSchema.js +8 -6
- package/admin/src/pages/Settings/components/RestartAlert/styles.d.ts +2 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.js +14 -8
- package/admin/src/pages/Settings/index.d.ts +3 -0
- package/admin/src/pages/Settings/index.js +225 -391
- package/admin/src/pages/Settings/utils/api.d.ts +7 -0
- package/admin/src/pages/Settings/utils/api.js +60 -55
- package/admin/src/pages/utils/api.d.ts +12 -0
- package/admin/src/pages/utils/api.js +58 -53
- package/admin/src/permissions.d.ts +28 -0
- package/admin/src/permissions.js +31 -17
- package/admin/src/pluginId.d.ts +2 -0
- package/admin/src/pluginId.js +29 -5
- package/admin/src/reducers.d.ts +7 -0
- package/admin/src/reducers.js +10 -6
- package/admin/src/translations/en.json +131 -131
- package/admin/src/translations/fr.json +132 -1
- package/admin/src/translations/pt-BR.json +130 -130
- package/admin/src/utils/axiosInstance.d.ts +3 -0
- package/admin/src/utils/axiosInstance.js +21 -27
- package/admin/src/utils/constants.d.ts +25 -0
- package/admin/src/utils/constants.js +23 -22
- package/admin/src/utils/getApiUrl.d.ts +3 -0
- package/admin/src/utils/getApiUrl.js +6 -5
- package/admin/src/utils/getMessage.d.ts +4 -0
- package/admin/src/utils/getMessage.js +15 -15
- package/admin/src/utils/getRelatedGroups.d.ts +4 -0
- package/admin/src/utils/getRelatedGroups.js +5 -3
- package/admin/src/utils/getUrl.d.ts +3 -0
- package/admin/src/utils/getUrl.js +6 -5
- package/admin/src/utils/handleAPIError.d.ts +4 -0
- package/admin/src/utils/handleAPIError.js +12 -11
- package/admin/src/utils/index.d.ts +12 -0
- package/admin/src/utils/index.js +29 -11
- package/admin/src/utils/parseRegExp.d.ts +6 -0
- package/admin/src/utils/parseRegExp.js +6 -5
- package/admin/src/utils/renderEntryTitle.d.ts +4 -0
- package/admin/src/utils/renderEntryTitle.js +11 -12
- package/admin/src/utils/renderInitials.d.ts +3 -0
- package/admin/src/utils/renderInitials.js +10 -5
- package/admin/src/utils/resolveCommentStatus.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatus.js +17 -21
- package/admin/src/utils/resolveCommentStatusColor.d.ts +4 -0
- package/admin/src/utils/resolveCommentStatusColor.js +19 -19
- package/content-types/comment.d.ts +91 -0
- package/content-types/comment.js +87 -88
- package/content-types/index.d.ts +143 -0
- package/content-types/index.js +15 -10
- package/content-types/report.d.ts +48 -0
- package/content-types/report.js +44 -49
- package/package.json +24 -19
- package/permissions.d.ts +18 -0
- package/permissions.js +12 -13
- package/server/bootstrap.d.ts +4 -0
- package/server/bootstrap.js +56 -62
- package/server/config/index.d.ts +4 -0
- package/server/config/index.js +17 -15
- package/server/controllers/admin.d.ts +4 -0
- package/server/controllers/admin.js +134 -167
- package/server/controllers/client.d.ts +4 -0
- package/server/controllers/client.js +120 -112
- package/server/controllers/index.d.ts +6 -0
- package/server/controllers/index.js +12 -8
- package/server/controllers/utils/functions.d.ts +7 -0
- package/server/controllers/utils/functions.js +22 -17
- package/server/controllers/utils/parsers.d.ts +10 -0
- package/server/controllers/utils/parsers.js +47 -19
- package/server/destroy.d.ts +3 -0
- package/server/destroy.js +3 -4
- package/server/graphql/index.d.ts +4 -0
- package/server/graphql/index.js +27 -25
- package/server/graphql/mutations/createAbuseReport.d.ts +11 -0
- package/server/graphql/mutations/createAbuseReport.js +22 -24
- package/server/graphql/mutations/createComment.d.ts +14 -0
- package/server/graphql/mutations/createComment.js +22 -24
- package/server/graphql/mutations/index.d.ts +4 -0
- package/server/graphql/mutations/index.js +24 -19
- package/server/graphql/mutations/removeComment.d.ts +11 -0
- package/server/graphql/mutations/removeComment.js +22 -24
- package/server/graphql/mutations/updateComment.d.ts +11 -0
- package/server/graphql/mutations/updateComment.js +22 -24
- package/server/graphql/queries/findAllFlat.d.ts +19 -0
- package/server/graphql/queries/findAllFlat.js +36 -34
- package/server/graphql/queries/findAllInHierarchy.d.ts +17 -0
- package/server/graphql/queries/findAllInHierarchy.js +30 -30
- package/server/graphql/queries/index.d.ts +4 -0
- package/server/graphql/queries/index.js +20 -17
- package/server/graphql/resolvers-config.d.ts +23 -0
- package/server/graphql/resolvers-config.js +11 -11
- package/server/graphql/types/comment-author.d.ts +4 -0
- package/server/graphql/types/comment-author.js +10 -8
- package/server/graphql/types/comment-nested.d.ts +4 -0
- package/server/graphql/types/comment-nested.js +17 -15
- package/server/graphql/types/comment.d.ts +4 -0
- package/server/graphql/types/comment.js +16 -14
- package/server/graphql/types/create-comment-author.d.ts +4 -0
- package/server/graphql/types/create-comment-author.js +10 -8
- package/server/graphql/types/create-comment.d.ts +4 -0
- package/server/graphql/types/create-comment.js +10 -8
- package/server/graphql/types/create-report.d.ts +4 -0
- package/server/graphql/types/create-report.js +10 -8
- package/server/graphql/types/id.d.ts +4 -0
- package/server/graphql/types/id.js +24 -23
- package/server/graphql/types/identify-comment-author.d.ts +4 -0
- package/server/graphql/types/identify-comment-author.js +7 -5
- package/server/graphql/types/index.d.ts +4 -0
- package/server/graphql/types/index.js +36 -17
- package/server/graphql/types/remove-comment.d.ts +4 -0
- package/server/graphql/types/remove-comment.js +9 -7
- package/server/graphql/types/report-reason.d.ts +4 -0
- package/server/graphql/types/report-reason.js +10 -8
- package/server/graphql/types/report.d.ts +4 -0
- package/server/graphql/types/report.js +12 -10
- package/server/graphql/types/response-find-all.d.ts +4 -0
- package/server/graphql/types/response-find-all.js +8 -6
- package/server/graphql/types/response-meta.d.ts +4 -0
- package/server/graphql/types/response-meta.js +7 -5
- package/server/graphql/types/response-pagination.d.ts +4 -0
- package/server/graphql/types/response-pagination.js +12 -10
- package/server/graphql/types/update-comment.d.ts +4 -0
- package/server/graphql/types/update-comment.js +10 -8
- package/server/index.d.ts +26 -0
- package/server/index.js +24 -21
- package/server/register.d.ts +3 -0
- package/server/register.js +3 -4
- package/server/routes/admin.d.ts +4 -0
- package/server/routes/admin.js +103 -109
- package/server/routes/client.d.ts +4 -0
- package/server/routes/client.js +84 -46
- package/server/routes/index.d.ts +11 -0
- package/server/routes/index.js +18 -14
- package/server/services/admin.d.ts +5 -0
- package/server/services/admin.js +134 -161
- package/server/services/client.d.ts +5 -0
- package/server/services/client.js +164 -168
- package/server/services/common.d.ts +5 -0
- package/server/services/common.js +192 -202
- package/server/services/graphql.d.ts +5 -0
- package/server/services/graphql.js +117 -182
- package/server/services/index.d.ts +8 -0
- package/server/services/index.js +15 -12
- package/server/services/utils/functions.d.ts +13 -0
- package/server/services/utils/functions.js +105 -109
- package/server/utils/constants.d.ts +9 -0
- package/server/utils/constants.js +19 -23
- package/server/utils/error.d.ts +19 -0
- package/server/utils/error.js +23 -18
- package/server/utils/functions.d.ts +6 -0
- package/server/utils/functions.js +35 -18
- package/strapi-admin.d.ts +3 -0
- package/strapi-admin.js +8 -3
- package/strapi-server.d.ts +177 -0
- package/strapi-server.js +43 -46
- package/tsconfig.tsbuildinfo +1 -0
- package/types/contentTypes.d.ts +48 -0
- package/types/contentTypes.js +3 -0
- package/.husky/pre-commit +0 -4
- package/LICENSE.md +0 -7
- package/__mocks__/initSetup.js +0 -108
- package/jest.config.js +0 -7
- package/server/controllers/utils/__tests__/functions.test.js +0 -43
- package/server/controllers/utils/__tests__/parsers.test.js +0 -94
- package/server/services/__tests__/common.test.js +0 -399
- package/server/services/utils/__tests__/functions.test.js +0 -53
- package/server/utils/__tests__/functions.test.js +0 -17
|
@@ -1,64 +1,85 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
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 react_1 = __importStar(require("react"));
|
|
30
|
+
const prop_types_1 = __importDefault(require("prop-types"));
|
|
31
|
+
const react_intl_1 = require("react-intl");
|
|
32
|
+
const react_query_1 = require("react-query");
|
|
33
|
+
const lodash_1 = require("lodash");
|
|
34
|
+
const Flex_1 = require("@strapi/design-system/Flex");
|
|
35
|
+
const IconButton_1 = require("@strapi/design-system/IconButton");
|
|
36
|
+
const Link_1 = require("@strapi/design-system/Link");
|
|
37
|
+
const Stack_1 = require("@strapi/design-system/Stack");
|
|
38
|
+
const Table_1 = require("@strapi/design-system/Table");
|
|
39
|
+
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
|
+
const utils_1 = require("../../../../utils");
|
|
43
|
+
const api_1 = require("../../../utils/api");
|
|
44
|
+
const pluginId_1 = require("../../../../pluginId");
|
|
45
|
+
const styles_1 = require("./styles");
|
|
46
|
+
const renderEntryTitle_1 = __importDefault(require("../../../../utils/renderEntryTitle"));
|
|
47
|
+
const DiscussionThreadItemApprovalFlowActions_1 = __importDefault(require("../../../../components/DiscussionThreadItemApprovalFlowActions"));
|
|
48
|
+
const StatusBadge_1 = __importDefault(require("../../../../components/StatusBadge"));
|
|
49
|
+
const styles_2 = require("../../../../components/IconButton/styles");
|
|
50
|
+
const DiscussionThreadItemReviewAction_1 = __importDefault(require("../../../../components/DiscussionThreadItemReviewAction"));
|
|
51
|
+
const Avatar_1 = __importDefault(require("../../../../components/Avatar"));
|
|
52
|
+
const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAccessReports, canReviewReports }, onClick, }) => {
|
|
28
53
|
const { id, reports } = item;
|
|
29
|
-
|
|
30
|
-
const
|
|
31
|
-
|
|
32
|
-
const
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
const { lockApp, unlockApp } = useOverlayBlocker();
|
|
36
|
-
|
|
37
|
-
const onSuccess = (message, stateAction = () => {}, indalidate = true) => async () => {
|
|
54
|
+
const [blockButtonsDisabled, setBlockButtonsDisabled] = (0, react_1.useState)(false);
|
|
55
|
+
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 () => {
|
|
38
60
|
if (indalidate) {
|
|
39
|
-
await queryClient.invalidateQueries(
|
|
61
|
+
await queryClient.invalidateQueries("get-data");
|
|
40
62
|
}
|
|
41
63
|
toggleNotification({
|
|
42
|
-
type:
|
|
43
|
-
message: `${pluginId}.${message}`,
|
|
64
|
+
type: "success",
|
|
65
|
+
message: `${pluginId_1.pluginId}.${message}`,
|
|
44
66
|
});
|
|
45
67
|
stateAction(false);
|
|
46
68
|
unlockApp();
|
|
47
69
|
};
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
const blockItemMutation = useMutation(blockItem, {
|
|
52
|
-
onSuccess: onSuccess(
|
|
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"),
|
|
53
75
|
onError,
|
|
54
76
|
refetchActive: false,
|
|
55
77
|
});
|
|
56
|
-
const blockItemThreadMutation = useMutation(blockItemThread, {
|
|
57
|
-
onSuccess: onSuccess(
|
|
78
|
+
const blockItemThreadMutation = (0, react_query_1.useMutation)(api_1.blockItemThread, {
|
|
79
|
+
onSuccess: onSuccess("page.details.actions.thread.block.confirmation.success"),
|
|
58
80
|
onError,
|
|
59
81
|
refetchActive: false,
|
|
60
82
|
});
|
|
61
|
-
|
|
62
83
|
const handleBlockItemClick = async () => {
|
|
63
84
|
if (canModerate) {
|
|
64
85
|
lockApp();
|
|
@@ -71,110 +92,78 @@ const DiscoverTableRow = ({ config, item, allowedActions: { canModerate, canAcce
|
|
|
71
92
|
blockItemThreadMutation.mutate(id);
|
|
72
93
|
}
|
|
73
94
|
};
|
|
74
|
-
|
|
75
95
|
const handleBlockActionClick = async (mutation, onCallback) => {
|
|
76
96
|
lockApp();
|
|
77
97
|
await mutation.mutateAsync(id);
|
|
78
98
|
onCallback();
|
|
79
99
|
};
|
|
80
|
-
|
|
81
100
|
const isLoading = blockItemMutation.isLoading || blockItemThreadMutation.isLoading;
|
|
82
|
-
const openReports = reports?.filter(_ => !_.resolved);
|
|
83
|
-
const hasReports = !isEmpty(openReports);
|
|
84
|
-
const reviewFlowEnabled =
|
|
85
|
-
|
|
101
|
+
const openReports = reports?.filter((_) => !_.resolved);
|
|
102
|
+
const hasReports = !(0, lodash_1.isEmpty)(openReports);
|
|
103
|
+
const reviewFlowEnabled = canAccessReports && hasReports && !(item.blocked || item.blockedThread);
|
|
86
104
|
const handleClick = () => onClick();
|
|
87
|
-
const handleBlockButtonsStateChange = disabled => setBlockButtonsDisabled(disabled);
|
|
88
|
-
|
|
105
|
+
const handleBlockButtonsStateChange = (disabled) => setBlockButtonsDisabled(disabled);
|
|
89
106
|
const renderStatus = (props) => {
|
|
90
|
-
const status = resolveCommentStatus({ ...props, reviewFlowEnabled });
|
|
91
|
-
const color = resolveCommentStatusColor(status);
|
|
92
|
-
|
|
93
|
-
return (<StatusBadge backgroundColor={`${color}100`} textColor={`${color}700`} color={color}>{ getMessage({
|
|
107
|
+
const status = (0, utils_1.resolveCommentStatus)({ ...props, reviewFlowEnabled });
|
|
108
|
+
const color = (0, utils_1.resolveCommentStatusColor)(status);
|
|
109
|
+
return (react_1.default.createElement(StatusBadge_1.default, { backgroundColor: `${color}100`, textColor: `${color}700`, color: color }, (0, utils_1.getMessage)({
|
|
94
110
|
id: `page.common.item.status.${status}`,
|
|
95
111
|
props: {
|
|
96
|
-
count: openReports.length
|
|
97
|
-
}
|
|
98
|
-
}, status)
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
let actionItemsCount = 1;
|
|
108
|
-
if(reviewFlowEnabled || needsApproval) {
|
|
112
|
+
count: openReports.length,
|
|
113
|
+
},
|
|
114
|
+
}, status)));
|
|
115
|
+
};
|
|
116
|
+
const renderEntryUrl = (entry) => entry ? `/content-manager/collectionType/${entry.uid}/${entry.id}` : null;
|
|
117
|
+
const renderDetailsUrl = (entry) => (0, utils_1.getUrl)(`discover/${entry.id}`);
|
|
118
|
+
const gotApprovalFlow = !(0, lodash_1.isNil)(item.approvalStatus);
|
|
119
|
+
const needsApproval = gotApprovalFlow && item.approvalStatus === "PENDING";
|
|
120
|
+
let actionItemsCount = 1;
|
|
121
|
+
if (reviewFlowEnabled || needsApproval) {
|
|
109
122
|
actionItemsCount = 2;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
{ (canModerate && needsApproval) && (
|
|
145
|
-
<DiscussionThreadItemApprovalFlowActions
|
|
146
|
-
id={item.id}
|
|
147
|
-
allowedActions={{ canModerate }}
|
|
148
|
-
queryToInvalidate="get-data" />
|
|
149
|
-
)}
|
|
150
|
-
<DiscussionThreadItemReviewAction
|
|
151
|
-
item={item}
|
|
152
|
-
queryToInvalidate="get-data"
|
|
153
|
-
areBlockButtonsDisabled={blockButtonsDisabled}
|
|
154
|
-
isLoading={isLoading}
|
|
155
|
-
allowedActions={{ canModerate, canAccessReports, canReviewReports }}
|
|
156
|
-
blockItemMutation={blockItemMutation}
|
|
157
|
-
blockItemThreadMutation={blockItemThreadMutation}
|
|
158
|
-
onBlockButtonsStateChange={handleBlockButtonsStateChange}
|
|
159
|
-
onBlockActionClick={handleBlockActionClick}
|
|
160
|
-
/>
|
|
161
|
-
<IconButton onClick={handleClick} label={ getMessage('page.discover.table.action.display') } icon={<Eye />} />
|
|
162
|
-
</IconButtonGroupStyled>
|
|
163
|
-
</Flex>
|
|
164
|
-
</Td>
|
|
165
|
-
</Tr>
|
|
166
|
-
);
|
|
123
|
+
}
|
|
124
|
+
return (react_1.default.createElement(Table_1.Tr, { key: item.id },
|
|
125
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
126
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", fontWeight: "bold" },
|
|
127
|
+
"#",
|
|
128
|
+
item.id)),
|
|
129
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
130
|
+
react_1.default.createElement(Stack_1.Stack, { size: 2, horizontal: true },
|
|
131
|
+
react_1.default.createElement(Avatar_1.default, { avatar: item.author?.avatar, name: item.author.name }),
|
|
132
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", variant: "pi" }, item.author.name))),
|
|
133
|
+
react_1.default.createElement(Table_1.Td, { style: { maxWidth: "30vw" } },
|
|
134
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800", ellipsis: true }, item.content)),
|
|
135
|
+
react_1.default.createElement(Table_1.Td, null, item.threadOf?.id ? (react_1.default.createElement(Link_1.Link, { to: renderDetailsUrl(item.threadOf) }, (0, utils_1.getMessage)({
|
|
136
|
+
id: "page.discover.table.cell.thread",
|
|
137
|
+
props: { id: item.threadOf.id },
|
|
138
|
+
}, "#" + item.threadOf.id))) : ("-")),
|
|
139
|
+
react_1.default.createElement(Table_1.Td, { style: { maxWidth: "15vw" } }, item.related ? (react_1.default.createElement(styles_1.TableLink, { to: renderEntryUrl(item.related) }, (0, renderEntryTitle_1.default)(item.related, config))) : ("-")),
|
|
140
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
141
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, formatDate(item.updatedAt || item.createdAt, {
|
|
142
|
+
dateStyle: "long",
|
|
143
|
+
timeStyle: "short",
|
|
144
|
+
}))),
|
|
145
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
146
|
+
react_1.default.createElement(Typography_1.Typography, { textColor: "neutral800" }, renderStatus(item))),
|
|
147
|
+
react_1.default.createElement(Table_1.Td, null,
|
|
148
|
+
react_1.default.createElement(Flex_1.Flex, { direction: "column", alignItems: "flex-end" },
|
|
149
|
+
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 }, queryToInvalidate: "get-data" })),
|
|
151
|
+
react_1.default.createElement(DiscussionThreadItemReviewAction_1.default, { item: item, queryToInvalidate: "get-data", areBlockButtonsDisabled: blockButtonsDisabled, isLoading: isLoading, allowedActions: {
|
|
152
|
+
canModerate,
|
|
153
|
+
canAccessReports,
|
|
154
|
+
canReviewReports,
|
|
155
|
+
}, blockItemMutation: blockItemMutation, blockItemThreadMutation: blockItemThreadMutation, onBlockButtonsStateChange: handleBlockButtonsStateChange, onBlockActionClick: handleBlockActionClick }),
|
|
156
|
+
react_1.default.createElement(IconButton_1.IconButton, { onClick: handleClick, label: (0, utils_1.getMessage)("page.discover.table.action.display"), icon: react_1.default.createElement(icons_1.Eye, null) }))))));
|
|
167
157
|
};
|
|
168
|
-
|
|
169
158
|
DiscoverTableRow.propTypes = {
|
|
170
|
-
config:
|
|
171
|
-
item:
|
|
172
|
-
allowedActions:
|
|
173
|
-
canModerate:
|
|
174
|
-
canAccessReports:
|
|
175
|
-
canReviewReports:
|
|
159
|
+
config: prop_types_1.default.object.isRequired,
|
|
160
|
+
item: prop_types_1.default.object.isRequired,
|
|
161
|
+
allowedActions: prop_types_1.default.shape({
|
|
162
|
+
canModerate: prop_types_1.default.bool,
|
|
163
|
+
canAccessReports: prop_types_1.default.bool,
|
|
164
|
+
canReviewReports: prop_types_1.default.bool,
|
|
176
165
|
}),
|
|
177
|
-
onClick:
|
|
166
|
+
onClick: prop_types_1.default.func.isRequired,
|
|
178
167
|
};
|
|
179
|
-
|
|
180
|
-
|
|
168
|
+
exports.default = DiscoverTableRow;
|
|
169
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
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
|