strapi-plugin-comments 2.1.0 → 2.1.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/.husky/pre-commit +4 -0
- package/LICENSE.md +7 -0
- package/admin/src/components/ActionButton/styles.ts +11 -0
- package/admin/src/components/Avatar/index.tsx +31 -0
- package/admin/src/components/ConfirmationDialog/index.tsx +88 -0
- package/admin/src/components/DiscussionStatus/index.tsx +36 -0
- package/admin/src/components/DiscussionThread/index.tsx +97 -0
- package/admin/src/components/DiscussionThreadItem/index.tsx +71 -0
- package/admin/src/components/DiscussionThreadItem/styles.ts +15 -0
- package/admin/src/components/DiscussionThreadItemActions/index.tsx +365 -0
- package/admin/src/components/DiscussionThreadItemActions/styles.ts +9 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/index.tsx +99 -0
- package/admin/src/components/DiscussionThreadItemApprovalFlowActions/styles.ts +8 -0
- package/admin/src/components/DiscussionThreadItemFooter/index.tsx +62 -0
- package/admin/src/components/DiscussionThreadItemFooter/styles.ts +15 -0
- package/admin/src/components/DiscussionThreadItemReviewAction/index.tsx +180 -0
- package/admin/src/components/FormSwitch/index.tsx +35 -0
- package/admin/src/components/FormSwitch/styles.ts +10 -0
- package/admin/src/components/IconButton/styles.ts +19 -0
- package/admin/src/components/Initializer/index.tsx +28 -0
- package/admin/src/components/LoadingIndicatorOverlay/index.tsx +19 -0
- package/admin/src/components/LoadingIndicatorOverlay/styles.ts +21 -0
- package/admin/src/components/Nav/index.tsx +61 -0
- package/admin/src/components/PluginIcon/index.tsx +14 -0
- package/admin/src/components/ReportsReviewModal/index.tsx +71 -0
- package/admin/src/components/ReportsReviewTable/index.tsx +233 -0
- package/admin/src/components/StatusBadge/index.tsx +21 -0
- package/admin/src/components/StatusBadge/styles.ts +19 -0
- package/admin/src/components/TableFilters/index.tsx +58 -0
- package/admin/src/components/TablePagination/index.tsx +37 -0
- package/admin/src/components/icons/comments.tsx +15 -0
- package/admin/src/components/icons/index.ts +6 -0
- package/admin/src/components/icons/lock.tsx +27 -0
- package/admin/src/components/icons/review.tsx +25 -0
- package/admin/src/components/icons/unlock.tsx +25 -0
- package/admin/src/hooks/useConfig.ts +58 -0
- package/admin/src/index.ts +98 -0
- package/admin/src/pages/App/index.tsx +67 -0
- package/admin/src/pages/App/reducer/actions.ts +10 -0
- package/admin/src/pages/App/reducer/constants.ts +4 -0
- package/admin/src/pages/App/reducer/index.ts +28 -0
- package/admin/src/pages/App/reducer/init.ts +9 -0
- package/admin/src/pages/App/reducer/selectors.ts +32 -0
- package/admin/src/pages/App/utils/api.ts +14 -0
- package/admin/src/pages/ComingSoonPage/index.tsx +31 -0
- package/admin/src/pages/Details/components/DetailsEntity/index.tsx +106 -0
- package/admin/src/pages/Details/components/DetailsFilters/index.tsx +43 -0
- package/admin/src/pages/Details/components/DetailsFilters/styles.ts +9 -0
- package/admin/src/pages/Details/index.tsx +169 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/index.tsx +252 -0
- package/admin/src/pages/Discover/components/DiscoverTableRow/styles.ts +9 -0
- package/admin/src/pages/Discover/index.tsx +230 -0
- package/admin/src/pages/Discover/utils/api.ts +22 -0
- package/admin/src/pages/Discover/utils/filtersSchema.ts +9 -0
- package/admin/src/pages/Settings/components/RestartAlert/styles.ts +10 -0
- package/admin/src/pages/Settings/index.tsx +602 -0
- package/admin/src/pages/Settings/utils/api.ts +71 -0
- package/admin/src/pages/utils/api.ts +70 -0
- package/admin/src/permissions.ts +30 -0
- package/admin/src/pluginId.ts +3 -0
- package/admin/src/reducers.ts +8 -0
- package/admin/src/utils/axiosInstance.ts +38 -0
- package/admin/src/utils/constants.ts +25 -0
- package/admin/src/utils/getApiUrl.ts +5 -0
- package/admin/src/utils/getMessage.ts +29 -0
- package/admin/src/utils/getRelatedGroups.ts +6 -0
- package/admin/src/utils/getUrl.ts +5 -0
- package/admin/src/utils/handleAPIError.ts +21 -0
- package/admin/src/utils/index.ts +11 -0
- package/admin/src/utils/parseRegExp.ts +9 -0
- package/admin/src/utils/renderEntryTitle.ts +16 -0
- package/admin/src/utils/renderInitials.ts +10 -0
- package/admin/src/utils/resolveCommentStatus.ts +37 -0
- package/admin/src/utils/resolveCommentStatusColor.ts +22 -0
- package/build/README.md +854 -0
- package/{admin → build/admin}/src/components/ActionButton/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/ActionButton/styles.js +0 -0
- package/{admin → build/admin}/src/components/Avatar/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/Avatar/index.js +0 -0
- package/{admin → build/admin}/src/components/ConfirmationDialog/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/ConfirmationDialog/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionStatus/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionStatus/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThread/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThread/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItem/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItem/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItem/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItem/styles.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemActions/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemActions/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemActions/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemActions/styles.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemApprovalFlowActions/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemApprovalFlowActions/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemApprovalFlowActions/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemApprovalFlowActions/styles.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemFooter/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemFooter/index.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemFooter/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemFooter/styles.js +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemReviewAction/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/DiscussionThreadItemReviewAction/index.js +0 -0
- package/{admin → build/admin}/src/components/FormSwitch/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/FormSwitch/index.js +0 -0
- package/{admin → build/admin}/src/components/FormSwitch/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/FormSwitch/styles.js +0 -0
- package/{admin → build/admin}/src/components/IconButton/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/IconButton/styles.js +0 -0
- package/{admin → build/admin}/src/components/Initializer/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/Initializer/index.js +0 -0
- package/{admin → build/admin}/src/components/LoadingIndicatorOverlay/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/LoadingIndicatorOverlay/index.js +0 -0
- package/{admin → build/admin}/src/components/LoadingIndicatorOverlay/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/LoadingIndicatorOverlay/styles.js +0 -0
- package/{admin → build/admin}/src/components/Nav/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/Nav/index.js +0 -0
- package/{admin → build/admin}/src/components/PluginIcon/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/PluginIcon/index.js +0 -0
- package/{admin → build/admin}/src/components/ReportsReviewModal/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/ReportsReviewModal/index.js +0 -0
- package/{admin → build/admin}/src/components/ReportsReviewTable/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/ReportsReviewTable/index.js +0 -0
- package/{admin → build/admin}/src/components/StatusBadge/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/StatusBadge/index.js +0 -0
- package/{admin → build/admin}/src/components/StatusBadge/styles.d.ts +0 -0
- package/{admin → build/admin}/src/components/StatusBadge/styles.js +0 -0
- package/{admin → build/admin}/src/components/TableFilters/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/TableFilters/index.js +0 -0
- package/{admin → build/admin}/src/components/TablePagination/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/TablePagination/index.js +0 -0
- package/{admin → build/admin}/src/components/icons/comments.d.ts +0 -0
- package/{admin → build/admin}/src/components/icons/comments.js +0 -0
- package/{admin → build/admin}/src/components/icons/index.d.ts +0 -0
- package/{admin → build/admin}/src/components/icons/index.js +0 -0
- package/{admin → build/admin}/src/components/icons/lock.d.ts +0 -0
- package/{admin → build/admin}/src/components/icons/lock.js +0 -0
- package/{admin → build/admin}/src/components/icons/review.d.ts +0 -0
- package/{admin → build/admin}/src/components/icons/review.js +0 -0
- package/{admin → build/admin}/src/components/icons/unlock.d.ts +0 -0
- package/{admin → build/admin}/src/components/icons/unlock.js +0 -0
- package/{admin → build/admin}/src/hooks/useConfig.d.ts +0 -0
- package/{admin → build/admin}/src/hooks/useConfig.js +0 -0
- package/{admin → build/admin}/src/index.d.ts +0 -0
- package/{admin → build/admin}/src/index.js +0 -0
- package/{admin → build/admin}/src/pages/App/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/index.js +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/actions.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/actions.js +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/constants.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/constants.js +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/index.js +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/init.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/init.js +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/selectors.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/reducer/selectors.js +0 -0
- package/{admin → build/admin}/src/pages/App/utils/api.d.ts +0 -0
- package/{admin → build/admin}/src/pages/App/utils/api.js +0 -0
- package/{admin → build/admin}/src/pages/ComingSoonPage/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/ComingSoonPage/index.js +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsEntity/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsEntity/index.js +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsFilters/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsFilters/index.js +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsFilters/styles.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Details/components/DetailsFilters/styles.js +0 -0
- package/{admin → build/admin}/src/pages/Details/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Details/index.js +0 -0
- package/{admin → build/admin}/src/pages/Discover/components/DiscoverTableRow/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Discover/components/DiscoverTableRow/index.js +0 -0
- package/{admin → build/admin}/src/pages/Discover/components/DiscoverTableRow/styles.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Discover/components/DiscoverTableRow/styles.js +0 -0
- package/{admin → build/admin}/src/pages/Discover/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Discover/index.js +0 -0
- package/{admin → build/admin}/src/pages/Discover/utils/api.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Discover/utils/api.js +0 -0
- package/{admin → build/admin}/src/pages/Discover/utils/filtersSchema.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Discover/utils/filtersSchema.js +0 -0
- package/{admin → build/admin}/src/pages/Settings/components/RestartAlert/styles.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Settings/components/RestartAlert/styles.js +0 -0
- package/{admin → build/admin}/src/pages/Settings/index.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Settings/index.js +0 -0
- package/{admin → build/admin}/src/pages/Settings/utils/api.d.ts +0 -0
- package/{admin → build/admin}/src/pages/Settings/utils/api.js +0 -0
- package/{admin → build/admin}/src/pages/utils/api.d.ts +0 -0
- package/{admin → build/admin}/src/pages/utils/api.js +0 -0
- package/{admin → build/admin}/src/permissions.d.ts +0 -0
- package/{admin → build/admin}/src/permissions.js +0 -0
- package/{admin → build/admin}/src/pluginId.d.ts +0 -0
- package/{admin → build/admin}/src/pluginId.js +0 -0
- package/{admin → build/admin}/src/reducers.d.ts +0 -0
- package/{admin → build/admin}/src/reducers.js +0 -0
- package/build/admin/src/translations/en.json +132 -0
- package/build/admin/src/translations/fr.json +132 -0
- package/build/admin/src/translations/pt-BR.json +132 -0
- package/{admin → build/admin}/src/utils/axiosInstance.d.ts +0 -0
- package/{admin → build/admin}/src/utils/axiosInstance.js +0 -0
- package/{admin → build/admin}/src/utils/constants.d.ts +0 -0
- package/{admin → build/admin}/src/utils/constants.js +0 -0
- package/{admin → build/admin}/src/utils/getApiUrl.d.ts +0 -0
- package/{admin → build/admin}/src/utils/getApiUrl.js +0 -0
- package/{admin → build/admin}/src/utils/getMessage.d.ts +0 -0
- package/{admin → build/admin}/src/utils/getMessage.js +0 -0
- package/{admin → build/admin}/src/utils/getRelatedGroups.d.ts +0 -0
- package/{admin → build/admin}/src/utils/getRelatedGroups.js +0 -0
- package/{admin → build/admin}/src/utils/getUrl.d.ts +0 -0
- package/{admin → build/admin}/src/utils/getUrl.js +0 -0
- package/{admin → build/admin}/src/utils/handleAPIError.d.ts +0 -0
- package/{admin → build/admin}/src/utils/handleAPIError.js +0 -0
- package/{admin → build/admin}/src/utils/index.d.ts +0 -0
- package/{admin → build/admin}/src/utils/index.js +0 -0
- package/{admin → build/admin}/src/utils/parseRegExp.d.ts +0 -0
- package/{admin → build/admin}/src/utils/parseRegExp.js +0 -0
- package/{admin → build/admin}/src/utils/renderEntryTitle.d.ts +0 -0
- package/{admin → build/admin}/src/utils/renderEntryTitle.js +0 -0
- package/{admin → build/admin}/src/utils/renderInitials.d.ts +0 -0
- package/{admin → build/admin}/src/utils/renderInitials.js +0 -0
- package/{admin → build/admin}/src/utils/resolveCommentStatus.d.ts +0 -0
- package/{admin → build/admin}/src/utils/resolveCommentStatus.js +0 -0
- package/{admin → build/admin}/src/utils/resolveCommentStatusColor.d.ts +0 -0
- package/{admin → build/admin}/src/utils/resolveCommentStatusColor.js +0 -0
- package/{content-types → build/content-types}/comment.d.ts +0 -0
- package/{content-types → build/content-types}/comment.js +0 -0
- package/{content-types → build/content-types}/index.d.ts +0 -0
- package/{content-types → build/content-types}/index.js +0 -0
- package/{content-types → build/content-types}/report.d.ts +0 -0
- package/{content-types → build/content-types}/report.js +0 -0
- package/build/package.json +94 -0
- package/{permissions.d.ts → build/permissions.d.ts} +0 -0
- package/{permissions.js → build/permissions.js} +0 -0
- package/{server → build/server}/bootstrap.d.ts +0 -0
- package/{server → build/server}/bootstrap.js +0 -0
- package/{server → build/server}/config/index.d.ts +0 -0
- package/{server → build/server}/config/index.js +0 -0
- package/{server → build/server}/controllers/admin.d.ts +0 -0
- package/{server → build/server}/controllers/admin.js +0 -0
- package/{server → build/server}/controllers/client.d.ts +0 -0
- package/{server → build/server}/controllers/client.js +0 -0
- package/{server → build/server}/controllers/index.d.ts +0 -0
- package/{server → build/server}/controllers/index.js +0 -0
- package/{server → build/server}/controllers/utils/functions.d.ts +0 -0
- package/{server → build/server}/controllers/utils/functions.js +0 -0
- package/{server → build/server}/controllers/utils/parsers.d.ts +0 -0
- package/{server → build/server}/controllers/utils/parsers.js +0 -0
- package/{server → build/server}/destroy.d.ts +0 -0
- package/{server → build/server}/destroy.js +0 -0
- package/{server → build/server}/graphql/index.d.ts +0 -0
- package/{server → build/server}/graphql/index.js +0 -0
- package/{server → build/server}/graphql/mutations/createAbuseReport.d.ts +0 -0
- package/{server → build/server}/graphql/mutations/createAbuseReport.js +0 -0
- package/{server → build/server}/graphql/mutations/createComment.d.ts +0 -0
- package/{server → build/server}/graphql/mutations/createComment.js +0 -0
- package/{server → build/server}/graphql/mutations/index.d.ts +0 -0
- package/{server → build/server}/graphql/mutations/index.js +0 -0
- package/{server → build/server}/graphql/mutations/removeComment.d.ts +0 -0
- package/{server → build/server}/graphql/mutations/removeComment.js +0 -0
- package/{server → build/server}/graphql/mutations/updateComment.d.ts +0 -0
- package/{server → build/server}/graphql/mutations/updateComment.js +0 -0
- package/{server → build/server}/graphql/queries/findAllFlat.d.ts +0 -0
- package/{server → build/server}/graphql/queries/findAllFlat.js +0 -0
- package/{server → build/server}/graphql/queries/findAllInHierarchy.d.ts +0 -0
- package/{server → build/server}/graphql/queries/findAllInHierarchy.js +0 -0
- package/{server → build/server}/graphql/queries/index.d.ts +0 -0
- package/{server → build/server}/graphql/queries/index.js +0 -0
- package/{server → build/server}/graphql/resolvers-config.d.ts +0 -0
- package/{server → build/server}/graphql/resolvers-config.js +0 -0
- package/{server → build/server}/graphql/types/comment-author.d.ts +0 -0
- package/{server → build/server}/graphql/types/comment-author.js +0 -0
- package/{server → build/server}/graphql/types/comment-nested.d.ts +0 -0
- package/{server → build/server}/graphql/types/comment-nested.js +0 -0
- package/{server → build/server}/graphql/types/comment.d.ts +0 -0
- package/{server → build/server}/graphql/types/comment.js +0 -0
- package/{server → build/server}/graphql/types/create-comment-author.d.ts +0 -0
- package/{server → build/server}/graphql/types/create-comment-author.js +0 -0
- package/{server → build/server}/graphql/types/create-comment.d.ts +0 -0
- package/{server → build/server}/graphql/types/create-comment.js +0 -0
- package/{server → build/server}/graphql/types/create-report.d.ts +0 -0
- package/{server → build/server}/graphql/types/create-report.js +0 -0
- package/{server → build/server}/graphql/types/id.d.ts +0 -0
- package/{server → build/server}/graphql/types/id.js +0 -0
- package/{server → build/server}/graphql/types/identify-comment-author.d.ts +0 -0
- package/{server → build/server}/graphql/types/identify-comment-author.js +0 -0
- package/{server → build/server}/graphql/types/index.d.ts +0 -0
- package/{server → build/server}/graphql/types/index.js +0 -0
- package/{server → build/server}/graphql/types/remove-comment.d.ts +0 -0
- package/{server → build/server}/graphql/types/remove-comment.js +0 -0
- package/{server → build/server}/graphql/types/report-reason.d.ts +0 -0
- package/{server → build/server}/graphql/types/report-reason.js +0 -0
- package/{server → build/server}/graphql/types/report.d.ts +0 -0
- package/{server → build/server}/graphql/types/report.js +0 -0
- package/{server → build/server}/graphql/types/response-find-all.d.ts +0 -0
- package/{server → build/server}/graphql/types/response-find-all.js +0 -0
- package/{server → build/server}/graphql/types/response-meta.d.ts +0 -0
- package/{server → build/server}/graphql/types/response-meta.js +0 -0
- package/{server → build/server}/graphql/types/response-pagination.d.ts +0 -0
- package/{server → build/server}/graphql/types/response-pagination.js +0 -0
- package/{server → build/server}/graphql/types/update-comment.d.ts +0 -0
- package/{server → build/server}/graphql/types/update-comment.js +0 -0
- package/{server → build/server}/index.d.ts +0 -0
- package/{server → build/server}/index.js +0 -0
- package/{server → build/server}/register.d.ts +0 -0
- package/{server → build/server}/register.js +0 -0
- package/{server → build/server}/routes/admin.d.ts +0 -0
- package/{server → build/server}/routes/admin.js +0 -0
- package/{server → build/server}/routes/client.d.ts +0 -0
- package/{server → build/server}/routes/client.js +0 -0
- package/{server → build/server}/routes/index.d.ts +0 -0
- package/{server → build/server}/routes/index.js +0 -0
- package/{server → build/server}/services/admin.d.ts +0 -0
- package/{server → build/server}/services/admin.js +0 -0
- package/{server → build/server}/services/client.d.ts +0 -0
- package/{server → build/server}/services/client.js +0 -0
- package/{server → build/server}/services/common.d.ts +0 -0
- package/{server → build/server}/services/common.js +4 -1
- package/{server → build/server}/services/graphql.d.ts +0 -0
- package/{server → build/server}/services/graphql.js +0 -0
- package/{server → build/server}/services/index.d.ts +0 -0
- package/{server → build/server}/services/index.js +0 -0
- package/{server → build/server}/services/utils/functions.d.ts +0 -0
- package/{server → build/server}/services/utils/functions.js +0 -0
- package/{server → build/server}/utils/constants.d.ts +0 -0
- package/{server → build/server}/utils/constants.js +0 -0
- package/{server → build/server}/utils/error.d.ts +0 -0
- package/{server → build/server}/utils/error.js +0 -0
- package/{server → build/server}/utils/functions.d.ts +0 -0
- package/{server → build/server}/utils/functions.js +0 -0
- package/{strapi-admin.d.ts → build/strapi-admin.d.ts} +0 -0
- package/{strapi-admin.js → build/strapi-admin.js} +0 -0
- package/{strapi-server.d.ts → build/strapi-server.d.ts} +0 -0
- package/{strapi-server.js → build/strapi-server.js} +0 -0
- package/build/tsconfig.tsbuildinfo +1 -0
- package/{types → build/types}/contentTypes.d.ts +0 -0
- package/{types → build/types}/contentTypes.js +0 -0
- package/content-types/comment.ts +93 -0
- package/content-types/index.ts +11 -0
- package/content-types/report.ts +50 -0
- package/jest.config.ts +22 -0
- package/package.json +33 -4
- package/permissions.ts +17 -0
- package/server/bootstrap.ts +66 -0
- package/server/config/index.ts +19 -0
- package/server/controllers/admin.ts +194 -0
- package/server/controllers/client.ts +220 -0
- package/server/controllers/index.ts +13 -0
- package/server/controllers/utils/functions.ts +27 -0
- package/server/controllers/utils/parsers.ts +59 -0
- package/server/destroy.ts +3 -0
- package/server/graphql/index.ts +27 -0
- package/server/graphql/mutations/createAbuseReport.ts +38 -0
- package/server/graphql/mutations/createComment.ts +41 -0
- package/server/graphql/mutations/index.ts +26 -0
- package/server/graphql/mutations/removeComment.ts +41 -0
- package/server/graphql/mutations/updateComment.ts +40 -0
- package/server/graphql/queries/findAllFlat.ts +58 -0
- package/server/graphql/queries/findAllInHierarchy.ts +47 -0
- package/server/graphql/queries/index.ts +22 -0
- package/server/graphql/resolvers-config.ts +13 -0
- package/server/graphql/types/comment-author.ts +12 -0
- package/server/graphql/types/comment-nested.ts +19 -0
- package/server/graphql/types/comment.ts +18 -0
- package/server/graphql/types/create-comment-author.ts +12 -0
- package/server/graphql/types/create-comment.ts +12 -0
- package/server/graphql/types/create-report.ts +12 -0
- package/server/graphql/types/id.ts +28 -0
- package/server/graphql/types/identify-comment-author.ts +9 -0
- package/server/graphql/types/index.ts +38 -0
- package/server/graphql/types/remove-comment.ts +11 -0
- package/server/graphql/types/report-reason.ts +12 -0
- package/server/graphql/types/report.ts +14 -0
- package/server/graphql/types/response-find-all.ts +10 -0
- package/server/graphql/types/response-meta.ts +9 -0
- package/server/graphql/types/response-pagination.ts +14 -0
- package/server/graphql/types/update-comment.ts +12 -0
- package/server/index.ts +20 -0
- package/server/register.ts +3 -0
- package/server/routes/admin.ts +118 -0
- package/server/routes/client.ts +95 -0
- package/server/routes/index.ts +25 -0
- package/server/services/admin.ts +406 -0
- package/server/services/client.ts +394 -0
- package/server/services/common.ts +503 -0
- package/server/services/graphql.ts +219 -0
- package/server/services/index.ts +13 -0
- package/server/services/utils/functions.ts +150 -0
- package/server/utils/constants.ts +23 -0
- package/server/utils/error.ts +44 -0
- package/server/utils/functions.ts +55 -0
- package/strapi-admin.ts +5 -0
- package/strapi-server.ts +77 -0
- package/tsconfig.json +38 -0
- package/types/common.d.ts +1 -0
- package/types/config.d.ts +35 -0
- package/types/constants.d.ts +3 -0
- package/types/contentTypes.ts +56 -0
- package/types/controllers.d.ts +125 -0
- package/types/graphql.d.ts +24 -0
- package/types/index.d.ts +7 -0
- package/types/services.d.ts +166 -0
- package/tsconfig.tsbuildinfo +0 -1
package/build/README.md
ADDED
|
@@ -0,0 +1,854 @@
|
|
|
1
|
+
<div align="center" width="150px">
|
|
2
|
+
<img style="width: 150px; height: auto;" src="public/assets/logo.png" alt="Logo - Strapi Comments plugin" />
|
|
3
|
+
</div>
|
|
4
|
+
<div align="center">
|
|
5
|
+
<h1>Strapi v4 - Comments plugin</h1>
|
|
6
|
+
<p>Powerful Strapi based comments moderation tool for you and your users</p>
|
|
7
|
+
<a href="https://www.npmjs.org/package/strapi-plugin-comments">
|
|
8
|
+
<img alt="GitHub package.json version" src="https://img.shields.io/github/package-json/v/VirtusLab-Open-Source/strapi-plugin-comments?label=npm&logo=npm">
|
|
9
|
+
</a>
|
|
10
|
+
<a href="https://www.npmjs.org/package/strapi-plugin-comments">
|
|
11
|
+
<img src="https://img.shields.io/npm/dm/strapi-plugin-comments.svg" alt="Monthly download on NPM" />
|
|
12
|
+
</a>
|
|
13
|
+
<a href="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-comments">
|
|
14
|
+
<img src="https://circleci.com/gh/VirtusLab-Open-Source/strapi-plugin-comments.svg?style=shield" alt="CircleCI" />
|
|
15
|
+
</a>
|
|
16
|
+
<a href="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments">
|
|
17
|
+
<img src="https://codecov.io/gh/VirtusLab-Open-Source/strapi-plugin-comments/coverage.svg?branch=master" alt="codecov.io" />
|
|
18
|
+
</a>
|
|
19
|
+
<a href="https://sharing.clickup.com/tl/xhcmx-83/strapiv-4-comments-roadmap">
|
|
20
|
+
<img src="https://img.shields.io/website?down_message=roadmap&label=product&up_message=roadmap&url=https%3A%2F%2Fsharing.clickup.com%2Ftl%2Fxhcmx-83%2Fstrapiv-4-comments-roadmap" />
|
|
21
|
+
</a>
|
|
22
|
+
<a href="https://sharing.clickup.com/b/xhcmx-63/strapiv-4-comments-board">
|
|
23
|
+
<img src="https://img.shields.io/website?down_message=board&label=product&up_color=blue&up_message=board&url=https%3A%2F%2Fsharing.clickup.com%2Fb%2Fxhcmx-63%2Fstrapiv-4-comments-board" />
|
|
24
|
+
</a>
|
|
25
|
+
</div>
|
|
26
|
+
|
|
27
|
+
---
|
|
28
|
+
|
|
29
|
+
<div style="margin: 20px 0" align="center">
|
|
30
|
+
<img style="width: 100%; height: auto;" src="public/assets/preview.png" alt="UI preview" />
|
|
31
|
+
</div>
|
|
32
|
+
|
|
33
|
+
A plugin for [Strapi Headless CMS](https://github.com/strapi/strapi) that provides end to end comments feature with their moderation panel, bad words filtering, abuse reporting and much more.
|
|
34
|
+
|
|
35
|
+
### Table of Contents
|
|
36
|
+
|
|
37
|
+
1. [✨ Features](#-features)
|
|
38
|
+
2. [⏳ Installation](#-installation)
|
|
39
|
+
3. [🖐 Requirements](#-requirements)
|
|
40
|
+
4. [🔧 Configuration](#-configuration)
|
|
41
|
+
- [Settings page](#in-v203-and-newer)
|
|
42
|
+
- [Plugin file](#in-v202-and-older--default-configuration-state-for-v203-and-newer)
|
|
43
|
+
5. [🕸️ Public API - REST](#%EF%B8%8F-public-rest-api-specification)
|
|
44
|
+
6. [🕸️ Public API - GraphQL](#%EF%B8%8F-public-graphql-specification)
|
|
45
|
+
7. [🤝 Contributing](#-contributing)
|
|
46
|
+
8. [👨💻 Community support](#-community-support)
|
|
47
|
+
|
|
48
|
+
## ✨ Features
|
|
49
|
+
|
|
50
|
+
- **Comments Public REST + GraphQL API:** Elegant, entirely customizable and a fully extensible admin panel.
|
|
51
|
+
- **Strapi & generic users:** Support for built-in & also generic non-Strapi users that might be the comments authors.
|
|
52
|
+
- **Any Content Type relation:** Comments can be linked to any of your Content Types by default. Simply, you're controlling it.
|
|
53
|
+
- **Moderation Panel:** Search & Filter through the bucket with your auditory comments. Manage them by blocking single ones or full threads. All in combined list & hierarchical tree view of threads.
|
|
54
|
+
- **Automated Bad Words filtering:** By default end users are not allowed to post abusing comments where bad words have been used.
|
|
55
|
+
- **Abuse Reporting & Reviewing:** Don't allow inferior language, react to reports from your community, send email notifications about issued reports
|
|
56
|
+
|
|
57
|
+
## ⚙️ Versions
|
|
58
|
+
|
|
59
|
+
- **Strapi v4** - (current) - [v2.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments)
|
|
60
|
+
- **Strapi v3** - [v1.x](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/tree/strapi-v3)
|
|
61
|
+
|
|
62
|
+
## ⏳ Installation
|
|
63
|
+
|
|
64
|
+
### Via Strapi Markerplace
|
|
65
|
+
|
|
66
|
+
As a ✅ **verified** plugin by Strapi team we're available on the [**Strapi Marketplace**](https://market.strapi.io/plugins/strapi-plugin-comments) as well as **In-App Marketplace** where you can follow the installation instructions.
|
|
67
|
+
|
|
68
|
+
<div style="margin: 20px 0" align="center">
|
|
69
|
+
<img style="width: 100%; height: auto;" src="public/assets/marketplace.png" alt="Strapi In-App Marketplace" />
|
|
70
|
+
</div>
|
|
71
|
+
|
|
72
|
+
### Via command line
|
|
73
|
+
|
|
74
|
+
(Use **yarn** to install this plugin within your Strapi project (recommended). [Install yarn with these docs](https://yarnpkg.com/lang/en/docs/install/).)
|
|
75
|
+
|
|
76
|
+
```bash
|
|
77
|
+
yarn add strapi-plugin-comments@latest
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
After successful installation you've to re-build your Strapi instance. To archive that simply use:
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
yarn build
|
|
84
|
+
yarn develop
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
or just run Strapi in the development mode with `--watch-admin` option:
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
yarn develop --watch-admin
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
The **Comments** plugin should appear in the **Plugins** section of Strapi sidebar after you run app again.
|
|
94
|
+
|
|
95
|
+
As a next step you must configure your the plugin by the way you want to. See [**Configuration**](#🔧-configuration) section.
|
|
96
|
+
|
|
97
|
+
All done. Enjoy 🎉
|
|
98
|
+
|
|
99
|
+
### Working in development mode
|
|
100
|
+
|
|
101
|
+
1. Clone repository
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
git clone git@github.com:VirtusLab-Open-Source/strapi-plugin-comments.git
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
2. Create a soft link in your strapi project to plugin build folder
|
|
108
|
+
|
|
109
|
+
```sh
|
|
110
|
+
ln -s <your path>/strapi-plugin-comments/build <your path>/strapi-project/src/plugins/comments
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
3. Run develop or build command
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
// Watch for file changes
|
|
117
|
+
yarn develop
|
|
118
|
+
// or run build without nodemon
|
|
119
|
+
yarn build:dev
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
## 🖐 Requirements
|
|
123
|
+
|
|
124
|
+
Complete installation requirements are exact same as for Strapi itself and can be found in the documentation under [Installation Requirements](https://docs.strapi.io/developer-docs/latest/getting-started/introduction.html).
|
|
125
|
+
|
|
126
|
+
**Minimum environment requirements**
|
|
127
|
+
|
|
128
|
+
- Node.js `>=14.x.x`
|
|
129
|
+
- NPM `>=7.x.x`
|
|
130
|
+
|
|
131
|
+
In our minimum support we're following [official Node.js releases timelines](https://nodejs.org/en/about/releases/).
|
|
132
|
+
|
|
133
|
+
**Supported Strapi versions**:
|
|
134
|
+
|
|
135
|
+
- Strapi v4.1.7 (recently tested)
|
|
136
|
+
- Strapi v4.x
|
|
137
|
+
|
|
138
|
+
> 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).
|
|
139
|
+
|
|
140
|
+
**We recommend always using the latest version of Strapi to start your new projects**.
|
|
141
|
+
|
|
142
|
+
## 🔧 Configuration
|
|
143
|
+
|
|
144
|
+
To start your journey with **Comments plugin** you must first setup it using the dedicated Settings page (`v2.0.3` and newer) or for any version, put your configuration in `config/plugins.js`. Anyway we're recommending the click-through option where your configuration is going to be properly validated.
|
|
145
|
+
|
|
146
|
+
### In `v2.0.3` and newer
|
|
147
|
+
|
|
148
|
+
Version `2.0.3` introduce the intuitive **Settings** page which you can easly access via `Strapi Settings -> Section: Comments Plugin -> Configuration`. On dedicated page you will be able to setup all crucial properties which drives the plugin and customize each individual collection for which **Comments plugin** should be enabled.
|
|
149
|
+
|
|
150
|
+
On the dedicated page, you will be able to set up all crucial properties which drive the plugin and customize each individual collection for which **Comments plugin** should be enabled.
|
|
151
|
+
|
|
152
|
+
<div style="margin: 20px 0" align="center">
|
|
153
|
+
<img style="width: 100%; height: auto;" src="public/assets/configuration.png" alt="Plugin configuration" />
|
|
154
|
+
</div>
|
|
155
|
+
|
|
156
|
+
> _Note_
|
|
157
|
+
> Default configuration for your plugin is fetched from `config/plugins.js` or directly from the plugin itself. If you would like to customize the default state to which you might revert, please follow the next section.
|
|
158
|
+
|
|
159
|
+
### In `v2.0.2` and older + default configuration state for `v2.0.3` and newer
|
|
160
|
+
|
|
161
|
+
To setup amend default plugin configuration we recommend to put following snippet as part of `config/plugins.js` or `config/<env>/plugins.js` file. If the file does not exist yet, you have to create it manually. If you've got already configurations for other plugins stores by this way, use just the `comments` part within exising `plugins` item.
|
|
162
|
+
|
|
163
|
+
```js
|
|
164
|
+
module.exports = ({ env }) => ({
|
|
165
|
+
//...
|
|
166
|
+
comments: {
|
|
167
|
+
enabled: true,
|
|
168
|
+
config: {
|
|
169
|
+
badWords: false,
|
|
170
|
+
moderatorRoles: ["Authenticated"],
|
|
171
|
+
approvalFlow: ["api::page.page"],
|
|
172
|
+
entryLabel: {
|
|
173
|
+
"*": ["Title", "title", "Name", "name", "Subject", "subject"],
|
|
174
|
+
"api::page.page": ["MyField"],
|
|
175
|
+
},
|
|
176
|
+
reportReasons: {
|
|
177
|
+
MY_CUSTOM_REASON: "MY_CUSTOM_REASON",
|
|
178
|
+
},
|
|
179
|
+
gql: {
|
|
180
|
+
// ...
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
},
|
|
184
|
+
//...
|
|
185
|
+
});
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
### Properties
|
|
189
|
+
|
|
190
|
+
- `enabledCollections` - list of Collection and Single Types for which plugin should be enabled in format like `'api::<collection name>.<content type name>'`. By default it's empty and none comments are not enabled for any of type in Strapi.
|
|
191
|
+
- `badWords` - Enabled support for [bad words filtering](https://www.npmjs.com/package/bad-words). Can be turned off or overwritten using [options reference](https://www.npmjs.com/package/bad-words#constructor). Default value: `true`.
|
|
192
|
+
- `moderatorRoles` - Optional list of names of roles. Users with those roles will be notified by email when a new abuse report is created. This feature requires a built-in [Strapi email plugin](https://docs.strapi.io/developer-docs/latest/plugins/email.html) configured.
|
|
193
|
+
- `approvalFlow` - list of Content Types which are supporting approval flow. Values must be in format like `'api::<collection name>.<content type name>'`. For not included, posted comments are going to be immediately visible.
|
|
194
|
+
- `entryLabel` - ordered list of property names per Content Type to generate related entity label. Keys must be in format like `'api::<collection name>.<content type name>'`. Default formatting set as `*`.
|
|
195
|
+
- `reportReasons` - set of enums you would like to use for issuing abuse reports. Provided by default `'BAD_LANGUAGE'`, `'DISCRIMINATION'` and `'OTHER'`.
|
|
196
|
+
- `gql` - specific configuration for GraphQL. See [Additional GQL Configuration](#additional-gql-configuration)
|
|
197
|
+
|
|
198
|
+
## Additional GQL Configuration
|
|
199
|
+
|
|
200
|
+
All you need to do is to install and enable `@strapi/plugin-graphql` for you instance based on the **[official Strapi v4 docs](https://docs.strapi.io/developer-docs/latest/plugins/graphql.html#configurations)** and decide if you would like to call it by anyone (open for world) or only by authenticated users (Strapi users).
|
|
201
|
+
|
|
202
|
+
> **Important!**
|
|
203
|
+
> If you're using `config/plugins.js` to configure your plugins , please put `comments` property before `graphql`. Otherwise types are not going to be properly added to GraphQL Schema. That's because of dynamic types which base on plugin configuration which are added on `boostrap` stage, not `register`. This is not valid if you're using `graphql` plugin without any custom configuration, so most of cases in real.
|
|
204
|
+
|
|
205
|
+
```json
|
|
206
|
+
{
|
|
207
|
+
// ...
|
|
208
|
+
"gql": {
|
|
209
|
+
"auth": true // Default: false
|
|
210
|
+
}
|
|
211
|
+
// ...
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
### Properties
|
|
216
|
+
|
|
217
|
+
- `auth` - does GraphQL Queries should be authenticated or not? Default: `false`
|
|
218
|
+
|
|
219
|
+
### Queries
|
|
220
|
+
|
|
221
|
+
See [available GQL specification section](#public-graphql-specification).
|
|
222
|
+
|
|
223
|
+
> If `auth` is set to `true` you must provide relevant authentication headers to all requests like for example:
|
|
224
|
+
>
|
|
225
|
+
> ```json
|
|
226
|
+
> {
|
|
227
|
+
> "Authorization": "Bearer <your token here>"
|
|
228
|
+
> }
|
|
229
|
+
> ```
|
|
230
|
+
|
|
231
|
+
## 👤 RBAC
|
|
232
|
+
|
|
233
|
+
Plugin provides granular permissions based on Strapi RBAC functionality.
|
|
234
|
+
|
|
235
|
+
### Mandatory permissions
|
|
236
|
+
|
|
237
|
+
For any role different than **Super Admin**, to access the **Comments panel** you must set following permissions:
|
|
238
|
+
|
|
239
|
+
- _Plugins_ -> _Content-type-builder_ -> _Read_ - gives you ability to fetch Content Type schema
|
|
240
|
+
- _Plugins_ -> _Comments_ -> _Comments: Read_ - gives you the basic read access to **Comments Panel**
|
|
241
|
+
|
|
242
|
+
### Optional permissions
|
|
243
|
+
|
|
244
|
+
Feature / Capability focused permissions:
|
|
245
|
+
|
|
246
|
+
- _Plugins_ -> _Comments_ -> _Comments: Moderate_ - allows you to block, unblock, approve & reject comments
|
|
247
|
+
- _Plugins_ -> _Comments_ -> _Reports: Read_ - allows you to see the list of issued abuse reports against comments
|
|
248
|
+
- _Plugins_ -> _Comments_ -> _Reports: Moderate_ - allows you to review (resolve) issued abuse reports against comments
|
|
249
|
+
|
|
250
|
+
## Base Comment model
|
|
251
|
+
|
|
252
|
+
```json
|
|
253
|
+
{
|
|
254
|
+
"id": 1,
|
|
255
|
+
"content": "My comment content",
|
|
256
|
+
"blocked": null,
|
|
257
|
+
"blockedThread": true,
|
|
258
|
+
"blockReason": null,
|
|
259
|
+
"authorUser": null,
|
|
260
|
+
"removed": null,
|
|
261
|
+
"approvalStatus": "APPROVED", // Only in case of enabled approval flow. Default: null
|
|
262
|
+
"author": {
|
|
263
|
+
"id": "207ccfdc-94ba-45eb-979c-790f6f49c392", // For Strapi users id reflects to the format used by your Strapi
|
|
264
|
+
"name": "Joe Doe", // For Strapi users it is equal to 'username' field
|
|
265
|
+
"email": "jdoe@sample.com",
|
|
266
|
+
"avatar": null
|
|
267
|
+
},
|
|
268
|
+
"createdAt": "2020-07-14T20:13:01.649Z",
|
|
269
|
+
"updatedAt": "2020-07-14T20:13:01.670Z",
|
|
270
|
+
"related": {}, // Related content type entity
|
|
271
|
+
"reports": [] // Reports issued against this comment
|
|
272
|
+
}
|
|
273
|
+
```
|
|
274
|
+
|
|
275
|
+
## 🕸️ Public REST API specification
|
|
276
|
+
|
|
277
|
+
**Strapi Users vs. Generic authors**
|
|
278
|
+
|
|
279
|
+
> Keep in mind that if you're using auth / authz your requests to setup proper user contexts it has got higher priority in order to take author data comparing to `author` property provided as part of your payload.
|
|
280
|
+
|
|
281
|
+
### Get Comments
|
|
282
|
+
|
|
283
|
+
_GraphQL equivalent: [Public GraphQL API -> Get Comments](#get-comments-1)_
|
|
284
|
+
|
|
285
|
+
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
|
|
286
|
+
|
|
287
|
+
Return a hierarchical tree structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`.
|
|
288
|
+
|
|
289
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1`
|
|
290
|
+
|
|
291
|
+
**Example response body**
|
|
292
|
+
|
|
293
|
+
```json
|
|
294
|
+
[
|
|
295
|
+
{
|
|
296
|
+
// -- Comment Model fields ---,
|
|
297
|
+
"children": [
|
|
298
|
+
{
|
|
299
|
+
// -- Comment Model fields ---,
|
|
300
|
+
"children": [
|
|
301
|
+
// ...
|
|
302
|
+
]
|
|
303
|
+
}
|
|
304
|
+
// ...
|
|
305
|
+
]
|
|
306
|
+
}
|
|
307
|
+
// ...
|
|
308
|
+
]
|
|
309
|
+
```
|
|
310
|
+
|
|
311
|
+
#### Strapi REST API properties support:
|
|
312
|
+
|
|
313
|
+
- [field selection](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#field-selection)
|
|
314
|
+
- [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#sorting)
|
|
315
|
+
|
|
316
|
+
### Get Comments (flat structure)
|
|
317
|
+
|
|
318
|
+
_GraphQL equivalent: [Public GraphQL API -> Get Comments (flat structure)](#get-comments-flat-structure-1)_
|
|
319
|
+
|
|
320
|
+
`GET <host>/api/comments/api::<collection name>.<content type name>:<entity id>/flat`
|
|
321
|
+
|
|
322
|
+
Return a flat structure of comments for specified instance of Content Type like for example `Page` with `ID: 1`
|
|
323
|
+
|
|
324
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1/flat`
|
|
325
|
+
|
|
326
|
+
**Example response body**
|
|
327
|
+
|
|
328
|
+
```json
|
|
329
|
+
{
|
|
330
|
+
"data": [
|
|
331
|
+
{
|
|
332
|
+
// -- Comment Model fields ---
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
// -- Comment Model fields ---
|
|
336
|
+
}
|
|
337
|
+
// ...
|
|
338
|
+
],
|
|
339
|
+
"meta": {
|
|
340
|
+
"pagination": {
|
|
341
|
+
// payload based on Strapi REST Pagination specification
|
|
342
|
+
}
|
|
343
|
+
}
|
|
344
|
+
}
|
|
345
|
+
```
|
|
346
|
+
|
|
347
|
+
**Possible response codes**
|
|
348
|
+
|
|
349
|
+
- `200` - Successful. Response with list of comments (can be empty)
|
|
350
|
+
- `400` - Bad Request. Requested list for not valid / not existing Content Type
|
|
351
|
+
|
|
352
|
+
#### Strapi REST API properties support:
|
|
353
|
+
|
|
354
|
+
- [filtering](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/filtering-locale-publication.html#filtering)
|
|
355
|
+
- [field selection](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/populating-fields.html#field-selection)
|
|
356
|
+
- [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#sorting)
|
|
357
|
+
- [pagination](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/rest/sort-pagination.html#pagination)
|
|
358
|
+
|
|
359
|
+
### Post a Comment
|
|
360
|
+
|
|
361
|
+
_GraphQL equivalent: [Public GraphQL API -> Post a Comments](#post-a-comment-1)_
|
|
362
|
+
|
|
363
|
+
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>`
|
|
364
|
+
|
|
365
|
+
Posts a Comment related to specified instance of Content Type like for example `Page` with `ID: 1`
|
|
366
|
+
|
|
367
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1`
|
|
368
|
+
|
|
369
|
+
**Example request body**
|
|
370
|
+
|
|
371
|
+
_Generic (non Strapi User)_
|
|
372
|
+
|
|
373
|
+
```json
|
|
374
|
+
{
|
|
375
|
+
"author": {
|
|
376
|
+
"id": "<any ID like value>",
|
|
377
|
+
"name": "Joe Doe",
|
|
378
|
+
"email": "jdoe@sample.com",
|
|
379
|
+
"avatar": "<any image url>"
|
|
380
|
+
},
|
|
381
|
+
"content": "My sample response",
|
|
382
|
+
"threadOf": 2 // id of comment we would like to start / continue the thread (Optional)
|
|
383
|
+
}
|
|
384
|
+
```
|
|
385
|
+
|
|
386
|
+
_Strapi user_
|
|
387
|
+
|
|
388
|
+
> Author is taken directly from the request context
|
|
389
|
+
|
|
390
|
+
```json
|
|
391
|
+
{
|
|
392
|
+
"content": "My sample response",
|
|
393
|
+
"threadOf": 2 // id of comment we would like to start / continue the thread (Optional)
|
|
394
|
+
}
|
|
395
|
+
```
|
|
396
|
+
|
|
397
|
+
**Example response body**
|
|
398
|
+
|
|
399
|
+
```json
|
|
400
|
+
{
|
|
401
|
+
// -- Comment Model fields ---
|
|
402
|
+
}
|
|
403
|
+
```
|
|
404
|
+
|
|
405
|
+
**Possible response codes**
|
|
406
|
+
|
|
407
|
+
- `200` - Successful. Response with created Comment Model
|
|
408
|
+
- `400` - Bad Request. Missing field values or bad words check fails. Error message will provide relevant reason.
|
|
409
|
+
|
|
410
|
+
### Update Comment
|
|
411
|
+
|
|
412
|
+
_GraphQL equivalent: [Public GraphQL API -> Update Comments](#update-comment-1)_
|
|
413
|
+
|
|
414
|
+
`PUT <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>`
|
|
415
|
+
|
|
416
|
+
Updates a specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`
|
|
417
|
+
|
|
418
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1/comment/2`
|
|
419
|
+
|
|
420
|
+
**Example request body**
|
|
421
|
+
|
|
422
|
+
_Generic (non Strapi User)_
|
|
423
|
+
|
|
424
|
+
```json
|
|
425
|
+
{
|
|
426
|
+
"author": {
|
|
427
|
+
"id": "<any ID like value>"
|
|
428
|
+
},
|
|
429
|
+
"content": "My sample response"
|
|
430
|
+
}
|
|
431
|
+
```
|
|
432
|
+
|
|
433
|
+
_Strapi user_
|
|
434
|
+
|
|
435
|
+
> Author is taken directly from the request context
|
|
436
|
+
|
|
437
|
+
```json
|
|
438
|
+
{
|
|
439
|
+
"content": "My sample response"
|
|
440
|
+
}
|
|
441
|
+
```
|
|
442
|
+
|
|
443
|
+
**Example response body**
|
|
444
|
+
|
|
445
|
+
```json
|
|
446
|
+
{
|
|
447
|
+
// -- Comment Model fields ---
|
|
448
|
+
}
|
|
449
|
+
```
|
|
450
|
+
|
|
451
|
+
**Possible response codes**
|
|
452
|
+
|
|
453
|
+
- `200` - Successful. Response with updated Comment Model
|
|
454
|
+
- `400` - Bad Request. Missing field values or bad words check fails. Error message will provide relevant reason.
|
|
455
|
+
- `409` - Conflict. Occurs when trying to update a non existing or not own comment. Possible cause might be that `authorId` or `authorUser` mismatch with existing comment.
|
|
456
|
+
|
|
457
|
+
### Delete Comment
|
|
458
|
+
|
|
459
|
+
_GraphQL equivalent: [Public GraphQL API -> Delete Comment](#delete-comment-1)_
|
|
460
|
+
|
|
461
|
+
`DELETE <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>?authorId=<authorId>`
|
|
462
|
+
|
|
463
|
+
Deletes a specified Comment based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1`.
|
|
464
|
+
|
|
465
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1/comment/1?authorId=1`
|
|
466
|
+
|
|
467
|
+
**Example response body**
|
|
468
|
+
|
|
469
|
+
```json
|
|
470
|
+
{
|
|
471
|
+
// -- Empty Response ---
|
|
472
|
+
}
|
|
473
|
+
```
|
|
474
|
+
|
|
475
|
+
**Possible response codes**
|
|
476
|
+
|
|
477
|
+
- `200` - Successful with blank Response.
|
|
478
|
+
- `409` - Conflict. Occurs when trying to delete a non existing comment.
|
|
479
|
+
|
|
480
|
+
### Issue Abuse Report against specified Comment
|
|
481
|
+
|
|
482
|
+
_GraphQL equivalent: [Public GraphQL API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment-1)_
|
|
483
|
+
|
|
484
|
+
`POST <host>/api/comments/api::<collection name>.<content type name>:<entity id>/comment/<commentId>/report-abuse`
|
|
485
|
+
|
|
486
|
+
Reports abuse in specified Comment content based on it `commentId` and related to specified instance of Content Type like for example `Page` with `ID: 1` and requests moderator attention.
|
|
487
|
+
|
|
488
|
+
**Example URL**: `https://localhost:1337/api/comments/api::page.page:1/comment/2/report-abuse`
|
|
489
|
+
|
|
490
|
+
**Example request body**
|
|
491
|
+
|
|
492
|
+
```json
|
|
493
|
+
{
|
|
494
|
+
"reason": "<reason enum>",
|
|
495
|
+
"content": "This comment is not relevant"
|
|
496
|
+
}
|
|
497
|
+
```
|
|
498
|
+
|
|
499
|
+
_Available reason enums:_ `BAD_WORDS`, `OTHER`, `DISCRIMINATION` (want more? See [configuration section](#configuration).)
|
|
500
|
+
|
|
501
|
+
**Example response body**
|
|
502
|
+
|
|
503
|
+
```json
|
|
504
|
+
{
|
|
505
|
+
// -- Comment Abuse Report fields ---
|
|
506
|
+
}
|
|
507
|
+
```
|
|
508
|
+
|
|
509
|
+
**Possible response codes**
|
|
510
|
+
|
|
511
|
+
- `200` - Successful. Response with reported abuse.
|
|
512
|
+
- `409` - Conflict. Occurs when trying to report an abuse to a non existing comment.
|
|
513
|
+
|
|
514
|
+
## 🕸️ Public GraphQL specification
|
|
515
|
+
|
|
516
|
+
**Strapi Users vs. Generic authors**
|
|
517
|
+
|
|
518
|
+
> Keep in mind that if you're using auth / authz your requests to setup proper user contexts it has got higher priority in order to take author data comparing to `author` property provided as part of your payload.
|
|
519
|
+
|
|
520
|
+
**Testing**
|
|
521
|
+
|
|
522
|
+
> To test all queries and understand the schemas use GraphQL Playground exposed by `@strapi/plugin-graphql` on `http://localhost:1337/graphql`
|
|
523
|
+
|
|
524
|
+
### Get Comments
|
|
525
|
+
|
|
526
|
+
_REST API equivalent: [Public REST API -> Get Comments](#get-comments)_
|
|
527
|
+
|
|
528
|
+
**Example request**
|
|
529
|
+
|
|
530
|
+
```graphql
|
|
531
|
+
query {
|
|
532
|
+
findAllFlat(
|
|
533
|
+
relation: "api::page.page:1"
|
|
534
|
+
filters: { content: { contains: "Test" } }
|
|
535
|
+
) {
|
|
536
|
+
id
|
|
537
|
+
content
|
|
538
|
+
blocked
|
|
539
|
+
threadOf {
|
|
540
|
+
id
|
|
541
|
+
}
|
|
542
|
+
author {
|
|
543
|
+
id
|
|
544
|
+
name
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
}
|
|
548
|
+
```
|
|
549
|
+
|
|
550
|
+
**Example response**
|
|
551
|
+
|
|
552
|
+
```json
|
|
553
|
+
{
|
|
554
|
+
"data": {
|
|
555
|
+
"findAllFlat": [
|
|
556
|
+
{
|
|
557
|
+
"id": 3,
|
|
558
|
+
"content": "Test",
|
|
559
|
+
"blocked": false,
|
|
560
|
+
"threadOf": null,
|
|
561
|
+
"author": {
|
|
562
|
+
"id": "123456",
|
|
563
|
+
"name": "Joe Doe"
|
|
564
|
+
}
|
|
565
|
+
},
|
|
566
|
+
// ...
|
|
567
|
+
]
|
|
568
|
+
}
|
|
569
|
+
```
|
|
570
|
+
|
|
571
|
+
#### Strapi GraphQL API properties support:
|
|
572
|
+
|
|
573
|
+
- [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/graphql-api.html#sorting)
|
|
574
|
+
|
|
575
|
+
### Get Comments (flat structure)
|
|
576
|
+
|
|
577
|
+
_REST API equivalent: [Public REST API -> Get Comments (flat structure)](#get-comments-flat-structure)_
|
|
578
|
+
|
|
579
|
+
**Example request**
|
|
580
|
+
|
|
581
|
+
```graphql
|
|
582
|
+
query {
|
|
583
|
+
findAllInHierarchy(relation: "api::page.page:1") {
|
|
584
|
+
id
|
|
585
|
+
content
|
|
586
|
+
blocked
|
|
587
|
+
children {
|
|
588
|
+
id
|
|
589
|
+
content
|
|
590
|
+
}
|
|
591
|
+
threadOf {
|
|
592
|
+
id
|
|
593
|
+
}
|
|
594
|
+
author {
|
|
595
|
+
id
|
|
596
|
+
name
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
```
|
|
601
|
+
|
|
602
|
+
**Example response**
|
|
603
|
+
|
|
604
|
+
```json
|
|
605
|
+
{
|
|
606
|
+
"data": {
|
|
607
|
+
"findAllInHierarchy": [
|
|
608
|
+
{
|
|
609
|
+
"id": 1,
|
|
610
|
+
"content": "Test",
|
|
611
|
+
"blocked": false,
|
|
612
|
+
"children": [
|
|
613
|
+
{
|
|
614
|
+
"id": 6,
|
|
615
|
+
"content": "Text to search for"
|
|
616
|
+
}
|
|
617
|
+
// ...
|
|
618
|
+
],
|
|
619
|
+
"threadOf": null,
|
|
620
|
+
"author": {
|
|
621
|
+
"id": "123456",
|
|
622
|
+
"name": "Joe Doe"
|
|
623
|
+
}
|
|
624
|
+
}
|
|
625
|
+
// ...
|
|
626
|
+
]
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
```
|
|
630
|
+
|
|
631
|
+
#### Strapi GraphQL API properties support:
|
|
632
|
+
|
|
633
|
+
- [filtering](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/graphql-api.html#filters)
|
|
634
|
+
- [sorting](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/graphql-api.html#sorting)
|
|
635
|
+
- [pagination](https://docs.strapi.io/developer-docs/latest/developer-resources/database-apis-reference/graphql-api.html#pagination)
|
|
636
|
+
|
|
637
|
+
### Post a Comment
|
|
638
|
+
|
|
639
|
+
_REST API equivalent: [Public REST API -> Post a Comment](#post-a-comment)_
|
|
640
|
+
|
|
641
|
+
**Example request**
|
|
642
|
+
|
|
643
|
+
```graphql
|
|
644
|
+
mutation createComment {
|
|
645
|
+
createComment(
|
|
646
|
+
input: {
|
|
647
|
+
relation: "api::page.page:1"
|
|
648
|
+
content: "Hello World!"
|
|
649
|
+
threadOf: 3
|
|
650
|
+
author: { id: "12345678", name: "John Wick", email: "test@test.pl" } # Optional if using auth / authz requests
|
|
651
|
+
}
|
|
652
|
+
) {
|
|
653
|
+
id
|
|
654
|
+
content
|
|
655
|
+
threadOf {
|
|
656
|
+
id
|
|
657
|
+
}
|
|
658
|
+
author {
|
|
659
|
+
id
|
|
660
|
+
name
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
```
|
|
665
|
+
|
|
666
|
+
**Example response**
|
|
667
|
+
|
|
668
|
+
```json
|
|
669
|
+
{
|
|
670
|
+
"data": {
|
|
671
|
+
"createComment": {
|
|
672
|
+
"id": 34,
|
|
673
|
+
"content": "Hello World!",
|
|
674
|
+
"threadOf": {
|
|
675
|
+
"id": 3
|
|
676
|
+
},
|
|
677
|
+
"author": {
|
|
678
|
+
"id": "12345678",
|
|
679
|
+
"name": "John Wick"
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
}
|
|
684
|
+
```
|
|
685
|
+
|
|
686
|
+
### Update Comment
|
|
687
|
+
|
|
688
|
+
_REST API equivalent: [Public REST API -> Update Comment](#update-comment)_
|
|
689
|
+
|
|
690
|
+
**Example request**
|
|
691
|
+
|
|
692
|
+
```graphql
|
|
693
|
+
mutation updateComment {
|
|
694
|
+
updateComment(
|
|
695
|
+
input: {
|
|
696
|
+
id: 34
|
|
697
|
+
relation: "api::page.page:1"
|
|
698
|
+
content: "I've changed it!"
|
|
699
|
+
author: { id: "12345678" } # Optional if using auth / authz requests
|
|
700
|
+
}
|
|
701
|
+
) {
|
|
702
|
+
id
|
|
703
|
+
content
|
|
704
|
+
threadOf {
|
|
705
|
+
id
|
|
706
|
+
}
|
|
707
|
+
author {
|
|
708
|
+
id
|
|
709
|
+
name
|
|
710
|
+
}
|
|
711
|
+
createdAt
|
|
712
|
+
updatedAt
|
|
713
|
+
}
|
|
714
|
+
}
|
|
715
|
+
```
|
|
716
|
+
|
|
717
|
+
**Example response**
|
|
718
|
+
|
|
719
|
+
```json
|
|
720
|
+
{
|
|
721
|
+
"data": {
|
|
722
|
+
"updateComment": {
|
|
723
|
+
"id": 34,
|
|
724
|
+
"content": "I've changed it!",
|
|
725
|
+
"threadOf": {
|
|
726
|
+
"id": 3
|
|
727
|
+
},
|
|
728
|
+
"author": {
|
|
729
|
+
"id": "12345678",
|
|
730
|
+
"name": "John Wick"
|
|
731
|
+
},
|
|
732
|
+
"createdAt": "2022-01-26T07:45:35.978Z",
|
|
733
|
+
"updatedAt": "2022-01-26T07:47:44.659Z"
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
}
|
|
737
|
+
```
|
|
738
|
+
|
|
739
|
+
### Delete Comment
|
|
740
|
+
|
|
741
|
+
_REST API equivalent: [Public REST API -> Delete Comment](#delete-comment)_
|
|
742
|
+
|
|
743
|
+
**Example request**
|
|
744
|
+
|
|
745
|
+
```graphql
|
|
746
|
+
mutation removeComment {
|
|
747
|
+
removeComment(
|
|
748
|
+
input: {
|
|
749
|
+
id: 33
|
|
750
|
+
relation: "api::page.page:1"
|
|
751
|
+
author: { id: "12345678" } # Optional if using auth / authz requests
|
|
752
|
+
}
|
|
753
|
+
) {
|
|
754
|
+
id
|
|
755
|
+
removed
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
```
|
|
759
|
+
|
|
760
|
+
**Example response**
|
|
761
|
+
|
|
762
|
+
```json
|
|
763
|
+
{
|
|
764
|
+
"data": {
|
|
765
|
+
"removeComment": {
|
|
766
|
+
"id": 33,
|
|
767
|
+
"removed": true
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
```
|
|
772
|
+
|
|
773
|
+
### Issue Abuse Report against specified Comment
|
|
774
|
+
|
|
775
|
+
_REST API equivalent: [Public REST API -> Issue Abuse Report against specified Comment](#issue-abuse-report-against-specified-comment)_
|
|
776
|
+
|
|
777
|
+
**Example request body**
|
|
778
|
+
|
|
779
|
+
```graphql
|
|
780
|
+
mutation createAbuseReport {
|
|
781
|
+
createAbuseReport(
|
|
782
|
+
input: {
|
|
783
|
+
commentId: 34
|
|
784
|
+
relation: "api::page.page:1"
|
|
785
|
+
reason: BAD_LANGUAGE
|
|
786
|
+
content: "Rude language"
|
|
787
|
+
}
|
|
788
|
+
) {
|
|
789
|
+
id
|
|
790
|
+
reason
|
|
791
|
+
content
|
|
792
|
+
related {
|
|
793
|
+
id
|
|
794
|
+
author {
|
|
795
|
+
id
|
|
796
|
+
name
|
|
797
|
+
}
|
|
798
|
+
}
|
|
799
|
+
}
|
|
800
|
+
}
|
|
801
|
+
```
|
|
802
|
+
|
|
803
|
+
_Available reason enums:_ `BAD_WORDS`, `OTHER`, `DISCRIMINATION` (want more? See [configuration section](#configuration).)
|
|
804
|
+
|
|
805
|
+
**Example response**
|
|
806
|
+
|
|
807
|
+
```json
|
|
808
|
+
{
|
|
809
|
+
"data": {
|
|
810
|
+
"createAbuseReport": {
|
|
811
|
+
"id": 28,
|
|
812
|
+
"content": "Rude language",
|
|
813
|
+
"reason": "DISCRIMINATION",
|
|
814
|
+
"related": {
|
|
815
|
+
"id": 34,
|
|
816
|
+
"author": {
|
|
817
|
+
"id": "12345678",
|
|
818
|
+
"name": "John Wick"
|
|
819
|
+
}
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
```
|
|
825
|
+
|
|
826
|
+
## 🧩 Examples
|
|
827
|
+
|
|
828
|
+
Live example of plugin usage can be found in the [VirtusLab Strapi Examples](https://github.com/VirtusLab/strapi-examples/tree/master/strapi-v4-plugin-comments) repository.
|
|
829
|
+
|
|
830
|
+
## 🤝 Contributing
|
|
831
|
+
|
|
832
|
+
<div>
|
|
833
|
+
<a href="https://sharing.clickup.com/tl/xhcmx-83/strapiv-4-comments-roadmap">
|
|
834
|
+
<img src="https://img.shields.io/website?down_message=roadmap&label=product&up_message=roadmap&url=https%3A%2F%2Fsharing.clickup.com%2Ftl%2Fxhcmx-83%2Fstrapiv-4-comments-roadmap" />
|
|
835
|
+
</a>
|
|
836
|
+
<a href="https://sharing.clickup.com/b/xhcmx-63/strapiv-4-comments-board">
|
|
837
|
+
<img src="https://img.shields.io/website?down_message=board&label=product&up_color=blue&up_message=board&url=https%3A%2F%2Fsharing.clickup.com%2Fb%2Fxhcmx-63%2Fstrapiv-4-comments-board" />
|
|
838
|
+
</a>
|
|
839
|
+
</div>
|
|
840
|
+
|
|
841
|
+
Feel free to fork and make a Pull Request to this plugin project. All the input is warmly welcome!
|
|
842
|
+
|
|
843
|
+
## 👨💻 Community support
|
|
844
|
+
|
|
845
|
+
For general help using Strapi, please refer to [the official Strapi documentation](https://strapi.io/documentation/). For additional help, you can use one of these channels to ask a question:
|
|
846
|
+
|
|
847
|
+
- [Discord](https://discord.strapi.io/) We're present on official Strapi Discord workspace. Find us by `[VirtusLab]` prefix and DM.
|
|
848
|
+
- [Slack - VirtusLab Open Source](https://virtuslab-oss.slack.com) We're present on a public channel #strapi-molecules
|
|
849
|
+
- [GitHub](https://github.com/VirtusLab-Open-Source/strapi-plugin-comments/issues) (Bug reports, Contributions, Questions and Discussions)
|
|
850
|
+
- [E-mail](mailto:strapi@virtuslab.com) - we will respond back as soon as possible
|
|
851
|
+
|
|
852
|
+
## 📝 License
|
|
853
|
+
|
|
854
|
+
[MIT License](LICENSE.md) Copyright (c) [VirtusLab Sp. z o.o.](https://virtuslab.com/) & [Strapi Solutions](https://strapi.io/).
|