strapi-plugin-comments 1.0.2-beta.1 → 2.0.0-beta.2

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.
Files changed (149) hide show
  1. package/.circleci/config.yml +2 -2
  2. package/README.md +71 -95
  3. package/admin/src/components/ConfirmationDialog/index.js +56 -0
  4. package/admin/src/components/DiscussionStatus/index.js +33 -0
  5. package/admin/src/components/DiscussionThread/index.js +58 -0
  6. package/admin/src/components/DiscussionThreadItem/index.js +87 -0
  7. package/admin/src/components/DiscussionThreadItem/styles.js +87 -0
  8. package/admin/src/components/DiscussionThreadItemActions/index.js +176 -0
  9. package/admin/src/components/DiscussionThreadItemActions/styles.js +22 -0
  10. package/admin/src/components/DiscussionThreadItemMeta/index.js +31 -0
  11. package/admin/src/components/DiscussionThreadItemWarnings/index.js +137 -0
  12. package/admin/src/components/DiscussionThreadItemWarnings/styles.js +7 -0
  13. package/admin/src/components/EntityDetails/index.js +53 -0
  14. package/admin/src/{containers → components}/Initializer/index.js +4 -4
  15. package/admin/src/components/LoadingIndicatorOverlay/index.js +15 -0
  16. package/admin/src/components/LoadingIndicatorOverlay/styles.js +20 -0
  17. package/admin/src/components/Nav/index.js +45 -0
  18. package/admin/src/components/PluginIcon/index.js +12 -0
  19. package/admin/src/components/ReportsReviewModal/index.js +45 -0
  20. package/admin/src/components/ReportsReviewTable/index.js +142 -0
  21. package/admin/src/components/TableFilters/index.js +53 -0
  22. package/admin/src/components/TablePagination/index.js +35 -0
  23. package/admin/src/components/icons/comments.js +9 -0
  24. package/admin/src/index.js +58 -42
  25. package/admin/src/pages/App/index.js +60 -0
  26. package/admin/src/pages/App/reducer/actions.js +8 -0
  27. package/admin/src/pages/App/reducer/constants.js +4 -0
  28. package/admin/src/pages/App/reducer/index.js +27 -0
  29. package/admin/src/pages/App/reducer/init.js +7 -0
  30. package/admin/src/pages/App/reducer/selectors.js +35 -0
  31. package/admin/src/pages/App/utils/api.js +20 -0
  32. package/admin/src/pages/ComingSoonPage/index.js +25 -0
  33. package/admin/src/pages/Details/index.js +109 -0
  34. package/admin/src/pages/Details/utils/api.js +41 -0
  35. package/admin/src/pages/Discover/index.js +203 -0
  36. package/admin/src/pages/Discover/utils/api.js +20 -0
  37. package/admin/src/pages/Discover/utils/filtersSchema.js +9 -0
  38. package/admin/src/permissions.js +13 -33
  39. package/admin/src/pluginId.js +2 -4
  40. package/admin/src/reducers.js +8 -0
  41. package/admin/src/translations/en.json +72 -33
  42. package/admin/src/translations/fr.json +1 -0
  43. package/admin/src/utils/axiosInstance.js +35 -0
  44. package/admin/src/utils/constants.js +28 -0
  45. package/admin/src/utils/getApiUrl.js +5 -0
  46. package/admin/src/utils/getMessage.js +14 -0
  47. package/admin/src/utils/getRelatedGroups.js +5 -0
  48. package/admin/src/utils/getUrl.js +5 -0
  49. package/admin/src/utils/handleAPIError.js +15 -0
  50. package/admin/src/utils/index.js +6 -0
  51. package/codecov.yml +2 -1
  52. package/content-types/comment.js +97 -0
  53. package/content-types/index.js +11 -0
  54. package/content-types/report.js +54 -0
  55. package/package.json +11 -25
  56. package/server/bootstrap.js +5 -0
  57. package/server/config/index.js +10 -0
  58. package/server/controllers/admin.js +134 -0
  59. package/server/controllers/client.js +109 -0
  60. package/server/controllers/index.js +9 -0
  61. package/{controllers → server/controllers}/utils/__tests__/functions.test.js +0 -0
  62. package/{controllers → server/controllers}/utils/functions.js +1 -1
  63. package/server/destroy.js +5 -0
  64. package/server/index.js +22 -0
  65. package/server/register.js +5 -0
  66. package/server/routes/admin.js +92 -0
  67. package/server/routes/client.js +52 -0
  68. package/server/routes/index.js +15 -0
  69. package/server/services/admin.js +186 -0
  70. package/server/services/client.js +227 -0
  71. package/server/services/common.js +191 -0
  72. package/server/services/index.js +11 -0
  73. package/{services → server/services}/utils/__tests__/functions.test.js +7 -9
  74. package/{services → server/services}/utils/functions.js +19 -8
  75. package/server/utils/constants.js +16 -0
  76. package/{services → server}/utils/error.js +0 -0
  77. package/server/utils/functions.js +19 -0
  78. package/strapi-admin.js +3 -0
  79. package/strapi-server.js +9 -0
  80. package/admin/src/assets/images/icon-cross-blue.svg +0 -1
  81. package/admin/src/assets/images/icon_remove.svg +0 -19
  82. package/admin/src/assets/images/logo.svg +0 -5
  83. package/admin/src/components/AbuseReportsPopUp/ItemPreviewContainer.js +0 -8
  84. package/admin/src/components/AbuseReportsPopUp/ModalFooter.js +0 -31
  85. package/admin/src/components/AbuseReportsPopUp/TableContainer.js +0 -63
  86. package/admin/src/components/AbuseReportsPopUp/index.js +0 -148
  87. package/admin/src/components/Container/index.js +0 -7
  88. package/admin/src/components/EmptyView/index.js +0 -25
  89. package/admin/src/components/Filters/index.js +0 -151
  90. package/admin/src/components/Filters/index.styled.js +0 -82
  91. package/admin/src/components/Filters/utils.js +0 -21
  92. package/admin/src/components/Item/CardItem.js +0 -30
  93. package/admin/src/components/Item/CardWrapper.js +0 -10
  94. package/admin/src/components/Item/index.js +0 -92
  95. package/admin/src/components/ItemDetails/CardItem.js +0 -33
  96. package/admin/src/components/ItemDetails/CardLevelCounter.js +0 -46
  97. package/admin/src/components/ItemDetails/CardLevelCounterLink.js +0 -24
  98. package/admin/src/components/ItemDetails/CardLevelWrapper.js +0 -22
  99. package/admin/src/components/ItemDetails/CardWrapper.js +0 -52
  100. package/admin/src/components/ItemDetails/index.js +0 -151
  101. package/admin/src/components/ItemFooter/CardItemAuthor.js +0 -10
  102. package/admin/src/components/ItemFooter/CardItemRelation.js +0 -18
  103. package/admin/src/components/ItemFooter/Wrapper.js +0 -20
  104. package/admin/src/components/ItemFooter/index.js +0 -87
  105. package/admin/src/components/ItemHeader/CardHeaderBlocked.js +0 -24
  106. package/admin/src/components/ItemHeader/CardHeaderIndicator.js +0 -30
  107. package/admin/src/components/ItemHeader/CardHeaderIndicatorBlue.js +0 -11
  108. package/admin/src/components/ItemHeader/CardHeaderIndicatorRed.js +0 -11
  109. package/admin/src/components/ItemHeader/CardHeaderIndicatorsContainer.js +0 -18
  110. package/admin/src/components/ItemHeader/CardHeaderReports.js +0 -40
  111. package/admin/src/components/ItemHeader/Wrapper.js +0 -16
  112. package/admin/src/components/ItemHeader/index.js +0 -80
  113. package/admin/src/components/ItemModeration/Wrapper.js +0 -19
  114. package/admin/src/components/ItemModeration/index.js +0 -47
  115. package/admin/src/components/List/Container.js +0 -20
  116. package/admin/src/components/List/index.js +0 -21
  117. package/admin/src/components/Search/index.js +0 -83
  118. package/admin/src/containers/App/Wrapper.js +0 -14
  119. package/admin/src/containers/App/index.js +0 -47
  120. package/admin/src/containers/DataManagerProvider/actions.js +0 -11
  121. package/admin/src/containers/DataManagerProvider/index.js +0 -280
  122. package/admin/src/containers/DataManagerProvider/init.js +0 -5
  123. package/admin/src/containers/DataManagerProvider/reducer.js +0 -59
  124. package/admin/src/containers/DetailsView/Wrapper.js +0 -18
  125. package/admin/src/containers/DetailsView/index.js +0 -100
  126. package/admin/src/containers/ListView/FadedWrapper.js +0 -42
  127. package/admin/src/containers/ListView/Footer.js +0 -53
  128. package/admin/src/containers/ListView/Wrapper.js +0 -17
  129. package/admin/src/containers/ListView/components.js +0 -138
  130. package/admin/src/containers/ListView/index.js +0 -45
  131. package/admin/src/containers/Panel/actions.js +0 -5
  132. package/admin/src/containers/Panel/index.js +0 -191
  133. package/admin/src/containers/Panel/index.styled.js +0 -6
  134. package/admin/src/containers/Panel/reducer.js +0 -44
  135. package/admin/src/contexts/DataManagerContext.js +0 -5
  136. package/admin/src/hooks/useDataManager.js +0 -6
  137. package/admin/src/lifecycles.js +0 -3
  138. package/admin/src/translations/index.js +0 -7
  139. package/admin/src/utils/getTrad.js +0 -5
  140. package/admin/src/utils/getTradId.js +0 -5
  141. package/config/functions/bootstrap.js +0 -48
  142. package/config/routes.json +0 -116
  143. package/config/schema.graphql.js +0 -270
  144. package/controllers/comments.js +0 -211
  145. package/models/comment.js +0 -8
  146. package/models/comment.settings.json +0 -98
  147. package/models/report.js +0 -8
  148. package/models/report.settings.json +0 -49
  149. package/services/comments.js +0 -486
@@ -1,138 +0,0 @@
1
- import styled from 'styled-components';
2
- import { Button, FilterIcon as Filter } from 'strapi-helper-plugin';
3
- import RemoveIcon from '../../assets/images/icon-cross-blue.svg';
4
-
5
- const Wrapper = styled.div`
6
- padding-top: 1px;
7
- `;
8
-
9
- const FilterIcon = styled(Filter)`
10
- padding: 0 !important;
11
- margin: auto !important;
12
- > g {
13
- stroke: #282b2c;
14
- }
15
- `;
16
-
17
- const AddFilterCta = styled(Button)`
18
- display: flex;
19
- height: 30px;
20
- margin-right: 10px;
21
- padding: 0 10px;
22
- text-align: center;
23
- background-color: #ffffff;
24
- border: 1px solid #e3e9f3;
25
- border-radius: 2px;
26
- line-height: 28px;
27
- font-size: 13px;
28
- font-weight: 500;
29
- font-family: Lato;
30
- -webkit-font-smoothing: antialiased;
31
- cursor: pointer;
32
- &:hover {
33
- background: #f7f8f8;
34
- }
35
- &:focus,
36
- &:active {
37
- outline: 0;
38
- }
39
- > span {
40
- margin-left: 10px;
41
- }
42
- `;
43
-
44
- const Img = styled.img`
45
- height: 7px;
46
- margin: auto;
47
- margin-right: 0px;
48
- font-size: 12px;
49
- `;
50
-
51
- const FooterWrapper = styled.div`
52
- padding-top: 3rem;
53
- `;
54
-
55
- const Label = styled.label`
56
- display: inline-block;
57
- height: 32px;
58
- margin-left: 10px;
59
- line-height: 32px;
60
- color: #787e8f;
61
- font-size: 13px;
62
- font-style: italic;
63
- `;
64
-
65
- const SelectWrapper = styled.div`
66
- display: flex;
67
- `;
68
-
69
- const FilterWrapper = styled.div`
70
- display: inline-block;
71
- height: 30px;
72
- margin-bottom: 6px;
73
- margin-right: 10px;
74
- padding: 0 10px;
75
- background: rgba(0, 126, 255, 0.08);
76
- border: 1px solid rgba(0, 126, 255, 0.24);
77
- border-radius: 2px;
78
- line-height: 28px;
79
- color: #007eff;
80
- font-size: 13px;
81
-
82
- > span {
83
- display: inline-block;
84
- margin-top: -1px;
85
- }
86
-
87
- > span:nth-child(2) {
88
- font-weight: 700;
89
- }
90
-
91
- > span:nth-child(3) {
92
- cursor: pointer;
93
- }
94
-
95
- -webkit-font-smoothing: antialiased;
96
- `;
97
-
98
- const Separator = styled.span`
99
- height: 30px;
100
- margin-left: 10px;
101
- margin-right: 10px;
102
- line-height: 30px;
103
- &:after {
104
- content: '';
105
- height: 15px;
106
- border-left: 1px solid #007eff;
107
- opacity: 0.1;
108
- }
109
- `;
110
-
111
- const Remove = styled.span`
112
- height: 28px;
113
- cursor: pointer;
114
- vertical-align: middle;
115
-
116
- &:after {
117
- display: inline-block;
118
- content: '';
119
- width: 8px;
120
- height: 8px;
121
- margin: auto;
122
- margin-top: -3px;
123
- background-image: url(${RemoveIcon});
124
- }
125
- `;
126
-
127
- export {
128
- AddFilterCta,
129
- FilterIcon,
130
- FooterWrapper,
131
- Img,
132
- Label,
133
- SelectWrapper,
134
- FilterWrapper,
135
- Separator,
136
- Remove,
137
- Wrapper,
138
- };
@@ -1,45 +0,0 @@
1
- /*
2
- *
3
- * ListView
4
- *
5
- */
6
-
7
- import React from 'react';
8
- import { LoadingIndicatorPage } from 'strapi-helper-plugin';
9
- import { FormattedMessage } from 'react-intl';
10
- import { isEmpty } from 'lodash';
11
- import { FontAwesomeIcon } from '@fortawesome/react-fontawesome';
12
- import { faSearch } from '@fortawesome/free-solid-svg-icons';
13
-
14
- import Footer from './Footer';
15
- import Wrapper from './Wrapper';
16
- import FadedWrapper from './FadedWrapper';
17
-
18
- import List from '../../components/List';
19
- import EmptyView from '../../components/EmptyView';
20
-
21
- import useDataManager from '../../hooks/useDataManager';
22
-
23
- import getTrad from '../../utils/getTrad';
24
-
25
- const ListView = ({ relatedContentTypes }) => {
26
- const { items, isLoadingForDataToBeSet } = useDataManager();
27
-
28
- return (
29
- <Wrapper className="col-md-4">
30
- {isLoadingForDataToBeSet && <LoadingIndicatorPage />}
31
- <FadedWrapper>
32
- {isEmpty(items) && (
33
- <EmptyView>
34
- <FontAwesomeIcon icon={faSearch} size="5x" />
35
- <FormattedMessage id={getTrad('list.content.empty')} />
36
- </EmptyView>
37
- )}
38
- {!isEmpty(items) && <List items={[...items]} relatedContentTypes={relatedContentTypes} />}
39
- </FadedWrapper>
40
- <Footer />
41
- </Wrapper>
42
- );
43
- };
44
-
45
- export default ListView;
@@ -1,5 +0,0 @@
1
- export const GET_CONFIG = 'GET_CONFIG';
2
- export const GET_CONFIG_SUCCESS = 'GET_CONFIG_SUCCESS';
3
-
4
- export const GET_CONTENT_LIST_CONTENT_TYPE = 'GET_CONTENT_LIST_CONTENT_TYPE';
5
- export const GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED = 'GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED'
@@ -1,191 +0,0 @@
1
- /*
2
- *
3
- * CommentsPanel
4
- *
5
- */
6
-
7
- import React, { memo, useEffect, useReducer, useState } from 'react';
8
- import { useHistory } from 'react-router-dom';
9
- import { generateSearchFromFilters, PluginHeader, request, useGlobalContext } from 'strapi-helper-plugin';
10
- import { camelCase, get, isEmpty } from 'lodash';
11
-
12
- import ListView from '../ListView';
13
- import DetailsView from '../DetailsView';
14
- import Filters from '../../components/Filters';
15
- import { initFilters, isRelatedFilter } from '../../components/Filters/utils';
16
- import getTradId from '../../utils/getTradId';
17
- import useDataManager from '../../hooks/useDataManager';
18
- import { Container } from './index.styled';
19
- import {
20
- GET_CONTENT_LIST_CONTENT_TYPE,
21
- GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED,
22
- GET_CONFIG,
23
- GET_CONFIG_SUCCESS,
24
- } from './actions';
25
- import pluginId from '../../pluginId';
26
- import reducer, { initialState } from './reducer';
27
- import getTrad from '../../utils/getTrad';
28
-
29
- const getContentTypes = async (dispatch) => {
30
- try {
31
- dispatch({ type: GET_CONFIG });
32
- const { contentsTypes , relatedContentTypes } = await request(`/${pluginId}/moderation/config`, { method: 'GET' });
33
- dispatch({ type: GET_CONFIG_SUCCESS, contentsTypes, relatedContentTypes });
34
- } catch (err) {
35
- console.log('err', err);
36
- }
37
- };
38
-
39
- const fetchContentTypeList = async (dispatch, contentTypeName, prev) => {
40
- try {
41
- dispatch({ type: GET_CONTENT_LIST_CONTENT_TYPE });
42
- if (contentTypeName) {
43
- const { list } = await request(
44
- `/${pluginId}/moderation/contents-types/${contentTypeName}`,
45
- );
46
- dispatch({
47
- type: GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED,
48
- payload: {
49
- ...prev,
50
- [contentTypeName]: list,
51
- },
52
- });
53
- }
54
- } catch (err) {
55
- console.log('err', err);
56
- }
57
- };
58
-
59
- const Panel = () => {
60
- const [reducerState, dispatch] = useReducer(reducer, initialState);
61
- const {
62
- contentsTypes,
63
- relatedContentTypes,
64
- isLoadingContentsTypes,
65
- isLoadingEntries,
66
- availableEntriesMap,
67
- } = reducerState.toJS();
68
- const { formatMessage } = useGlobalContext();
69
- const { getSearchParams, search, items } = useDataManager();
70
- const newItemsCount = items.filter(_ => _.isNew).length;
71
-
72
- const { push } = useHistory();
73
-
74
- const { filters: queryFilters } = getSearchParams();
75
- const [filters, setFilters] = useState(initFilters(queryFilters));
76
-
77
- const [isOpenFilter, setIsOpenFilter] = useState(false);
78
-
79
- useEffect(
80
- () => {
81
- getContentTypes(dispatch);
82
- },
83
- [dispatch],
84
- );
85
-
86
- useEffect(() => {
87
- fetchContentTypeList(dispatch, get(filters, 'related.value'), availableEntriesMap || {});
88
- }, [filters, dispatch]);
89
-
90
- const onToggleOpen = () => {
91
- if (isEmpty(filters)) {
92
- setFilters(initFilters([]));
93
- }
94
- setIsOpenFilter(prevState => !prevState);
95
- };
96
- const onClose = () => setIsOpenFilter(false);
97
-
98
- const onRemoveFilter = ({ name }) => () => {
99
- onChangeFilter({ target: { name: `${name}.value`, value: '' } });
100
- onSubmit(isRelatedFilter(name) ? [name, 'entity'] : [name]);
101
- };
102
-
103
- const onChangeFilter = ({ target: { name, value } }) => {
104
- setFilters(prevState => {
105
- const [filterName, property] = name.split('-').map(camelCase);
106
- const filter = { ...(prevState[camelCase(filterName)] || {}) };
107
- if (filter) {
108
- if (isRelatedFilter(filterName) && prevState.entity) {
109
- prevState.entity.prevValue = prevState.entity.value;
110
- prevState.entity.value = '';
111
- }
112
- filter[property] = value;
113
- return { ...prevState, [camelCase(filterName)]: filter };
114
- }
115
- return { ...prevState };
116
- });
117
- };
118
-
119
- const onSubmit = (ignoreFilterNames = []) => {
120
- const searchParams = getSearchParams();
121
- searchParams.filters = Object
122
- .values(filters)
123
- .filter(({ value, name }) => !!value && !ignoreFilterNames.some(_ => _ === name));
124
- const newSearchParams = generateSearchFromFilters(searchParams);
125
- push({ search: newSearchParams });
126
- };
127
-
128
- const clearAll = () => {
129
- const searchParams = getSearchParams();
130
- searchParams.filters = [];
131
- const newSearchParams = generateSearchFromFilters(searchParams);
132
- setFilters(initFilters([]));
133
- push({ search: newSearchParams });
134
- };
135
-
136
- const filterPickerActions = [
137
- {
138
- label: getTrad(`list.header.filters.clearAll`),
139
- kind: 'secondary',
140
- onClick: () => {
141
- onClose();
142
- clearAll();
143
- },
144
- },
145
- {
146
- label: getTrad(`list.header.filters.apply`),
147
- kind: 'primary',
148
- type: 'button',
149
- onClick: () => {
150
- onClose();
151
- onSubmit();
152
- },
153
- },
154
- ];
155
-
156
- const isFilters = search.filters.length > 0;
157
-
158
- return (
159
- <>
160
- <Container isOpenFilter={isOpenFilter}>
161
- <PluginHeader
162
- title={formatMessage(getTradId('list.header.title'))}
163
- description={formatMessage(
164
- getTradId(isFilters ? 'list.header.filters.message' : 'list.header.description'),
165
- { count: isFilters ? items.length : newItemsCount })
166
- }
167
- actions={isOpenFilter ? filterPickerActions : []}
168
- />
169
- <Filters
170
- contentsTypes={contentsTypes}
171
- isLoadingContentsTypes={isLoadingContentsTypes}
172
- isLoadingEntries={isLoadingEntries}
173
- availableEntriesMap={availableEntriesMap}
174
- filters={filters}
175
- isOpenFilter={isOpenFilter}
176
- onToggleOpen={onToggleOpen}
177
- onChangeFilter={onChangeFilter}
178
- onRemoveFilter={onRemoveFilter}
179
- />
180
- </Container>
181
- <div className="container-fluid">
182
- <div className="row">
183
- <ListView relatedContentTypes={relatedContentTypes} />
184
- <DetailsView />
185
- </div>
186
- </div>
187
- </>
188
- );
189
- };
190
-
191
- export default memo(Panel);
@@ -1,6 +0,0 @@
1
- import styled from 'styled-components';
2
-
3
- export const Container = styled.div`
4
- padding: 2.5rem 30px 2.5rem 15px;
5
- background-color: ${({ isOpenFilter }) => isOpenFilter ? 'white' : ''}
6
- `;
@@ -1,44 +0,0 @@
1
- import { fromJS, Set } from 'immutable';
2
- import {
3
- GET_CONFIG,
4
- GET_CONFIG_SUCCESS,
5
- GET_CONTENT_LIST_CONTENT_TYPE,
6
- GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED,
7
- } from './actions';
8
-
9
- export const initialState = fromJS({
10
- isLoadingContentsTypes: false,
11
- isLoadingEntries: false,
12
- contentsTypes: [],
13
- relatedContentTypes: {},
14
- availableEntriesMap: Set(),
15
- });
16
-
17
- const reducer = (state, action) => {
18
- switch (action.type) {
19
- case GET_CONFIG: {
20
- return state
21
- .update('isLoadingContentsTypes', () => true);
22
- }
23
- case GET_CONFIG_SUCCESS: {
24
- return state
25
- .update('isLoadingContentsTypes', () => false)
26
- .update('contentsTypes', () => action.contentsTypes)
27
- .update('relatedContentTypes', () => action.relatedContentTypes);
28
- }
29
- case GET_CONTENT_LIST_CONTENT_TYPE: {
30
- return state
31
- .update('isLoadingEntries', () => true)
32
- .update('availableEntriesMap', () => ({}));
33
- }
34
- case GET_CONTENT_LIST_CONTENT_TYPE_SUCCEEDED: {
35
- return state
36
- .update('isLoadingEntries', () => false)
37
- .update('availableEntriesMap', () => action.payload);
38
- }
39
- default:
40
- return state;
41
- }
42
- };
43
-
44
- export default reducer;
@@ -1,5 +0,0 @@
1
- import { createContext } from 'react';
2
-
3
- const DataManagerContext = createContext();
4
-
5
- export default DataManagerContext;
@@ -1,6 +0,0 @@
1
- import { useContext } from 'react';
2
- import DataManagerContext from '../contexts/DataManagerContext';
3
-
4
- const useDataManager = () => useContext(DataManagerContext);
5
-
6
- export default useDataManager;
@@ -1,3 +0,0 @@
1
- function lifecycles() {}
2
-
3
- export default lifecycles;
@@ -1,7 +0,0 @@
1
- import en from './en.json';
2
-
3
- const trads = {
4
- en,
5
- };
6
-
7
- export default trads;
@@ -1,5 +0,0 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getTrad = id => `${pluginId}.${id}`;
4
-
5
- export default getTrad;
@@ -1,5 +0,0 @@
1
- import getTrad from './getTrad';
2
-
3
- const getTradId = (id) => ({ id: getTrad(id) });
4
-
5
- export default getTradId;
@@ -1,48 +0,0 @@
1
- module.exports = async () => {
2
- // Check if the plugin users-permissions is installed because the comments needs it
3
- if (Object.keys(strapi.plugins).indexOf('users-permissions') === -1) {
4
- throw new Error(
5
- 'In order to make the comments plugin work the users-permissions plugin is required'
6
- );
7
- }
8
-
9
- // Add permissions
10
- const actions = [
11
- {
12
- section: 'plugins',
13
- displayName: 'Access the Comments',
14
- uid: 'read',
15
- pluginName: 'comments',
16
- },
17
- {
18
- section: 'plugins',
19
- displayName: 'Modefation',
20
- uid: 'moderate',
21
- pluginName: 'comments',
22
- },
23
- {
24
- section: 'plugins',
25
- displayName: 'Single comments',
26
- uid: 'moderate.block.comment',
27
- subCategory: 'moderate',
28
- pluginName: 'comments',
29
- },
30
- {
31
- section: 'plugins',
32
- displayName: 'Comments threads',
33
- uid: 'moderate.block.thread',
34
- subCategory: 'moderate',
35
- pluginName: 'comments',
36
- },
37
- {
38
- section: 'plugins',
39
- displayName: 'Review & resolve reports',
40
- uid: 'moderate.reports',
41
- subCategory: 'moderate',
42
- pluginName: 'comments',
43
- },
44
- ];
45
-
46
- const { actionProvider } = strapi.admin.services.permission;
47
- await actionProvider.registerMany(actions);
48
- };
@@ -1,116 +0,0 @@
1
- {
2
- "routes": [
3
- {
4
- "method": "GET",
5
- "path": "/:relation",
6
- "handler": "comments.findAllInHierarchy",
7
- "config": {
8
- "policies": []
9
- }
10
- },
11
- {
12
- "method": "POST",
13
- "path": "/:relation",
14
- "handler": "comments.post",
15
- "config": {
16
- "policies": []
17
- }
18
- },
19
- {
20
- "method": "GET",
21
- "path": "/:relation/flat",
22
- "handler": "comments.findAllFlat",
23
- "config": {
24
- "policies": []
25
- }
26
- },
27
- {
28
- "method": "PUT",
29
- "path": "/:relation/comment/:commentId",
30
- "handler": "comments.put",
31
- "config": {
32
- "policies": []
33
- }
34
- },
35
- {
36
- "method": "POST",
37
- "path": "/:relation/comment/:commentId/report-abuse",
38
- "handler": "comments.reportAbuse",
39
- "config": {
40
- "policies": []
41
- }
42
- },
43
- {
44
- "method": "PATCH",
45
- "path": "/:relation/comment/:commentId/like",
46
- "handler": "comments.pointsUp",
47
- "config": {
48
- "policies": []
49
- }
50
- },
51
- {
52
- "method": "DELETE",
53
- "path": "/:relationId/:commentId",
54
- "handler": "comments.removeComment",
55
- "config": {
56
- "policies": []
57
- }
58
- },
59
- {
60
- "method": "GET",
61
- "path": "/moderation/all",
62
- "handler": "comments.findAll",
63
- "config": {
64
- "policies": [["admin::hasPermissions", ["plugins::comments.read"]]]
65
- }
66
- },
67
- {
68
- "method": "GET",
69
- "path": "/moderation/single/:id",
70
- "handler": "comments.findOne",
71
- "config": {
72
- "policies": [["admin::hasPermissions", ["plugins::comments.read"]]]
73
- }
74
- },
75
- {
76
- "method": "GET",
77
- "path": "/moderation/config",
78
- "handler": "comments.config",
79
- "config": {
80
- "policies": [["admin::hasPermissions", ["plugins::comments.read"]]]
81
- }
82
- },
83
- {
84
- "method": "GET",
85
- "path": "/moderation/contents-types/:contentTypeName",
86
- "handler": "comments.contentTypeName",
87
- "config": {
88
- "policies": [["admin::hasPermissions", ["plugins::comments.read"]]]
89
- }
90
- },
91
- {
92
- "method": "PUT",
93
- "path": "/moderation/block/:id",
94
- "handler": "comments.blockComment",
95
- "config": {
96
- "policies": [["admin::hasPermissions", ["plugins::comments.moderate.block.comment"]]]
97
- }
98
- },
99
- {
100
- "method": "PUT",
101
- "path": "/moderation/block-thread/:id",
102
- "handler": "comments.blockCommentThread",
103
- "config": {
104
- "policies": [["admin::hasPermissions", ["plugins::comments.moderate.block.thread"]]]
105
- }
106
- },
107
- {
108
- "method": "PATCH",
109
- "path": "/moderation/abuse-reports/:commentId/resolve/:id",
110
- "handler": "comments.resolveAbuseReport",
111
- "config": {
112
- "policies": [["admin::hasPermissions", ["plugins::comments.moderate.reports"]]]
113
- }
114
- }
115
- ]
116
- }