strapi-plugin-comments 2.0.7 → 2.0.8
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.
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useMemo, useState } from 'react';
|
|
2
2
|
import { useQuery } from 'react-query';
|
|
3
3
|
import { Formik } from 'formik';
|
|
4
|
-
import { capitalize, first, orderBy, isEmpty, isEqual } from 'lodash';
|
|
4
|
+
import { capitalize, first, orderBy, isEmpty, isEqual, isNil } from 'lodash';
|
|
5
5
|
import {
|
|
6
6
|
CheckPermissions,
|
|
7
7
|
LoadingIndicatorPage,
|
|
@@ -109,7 +109,7 @@ const Settings = () => {
|
|
|
109
109
|
.filter(_ => _) || [];
|
|
110
110
|
const entryLabel = configData?.entryLabel || {};
|
|
111
111
|
const approvalFlow = configData?.approvalFlow || [];
|
|
112
|
-
const badWords = configData?.badWords
|
|
112
|
+
const badWords = isNil(configData?.badWords) ? true : configData?.badWords;
|
|
113
113
|
const isGQLPluginEnabled = configData?.isGQLPluginEnabled;
|
|
114
114
|
const gqlAuthEnabled = configData?.gql?.auth || undefined;
|
|
115
115
|
const moderatorRoles = configData?.moderatorRoles
|
package/package.json
CHANGED
|
@@ -308,7 +308,7 @@ describe('Test Comments service functions utils', () => {
|
|
|
308
308
|
|
|
309
309
|
beforeEach(() => setup({ enabledCollections: [collection] }, true, {
|
|
310
310
|
'plugins::comments': db,
|
|
311
|
-
'api::collection': [relatedEntity],
|
|
311
|
+
'api::collection': [relatedEntity, { id: 2, title: 'Test 2', uid: collection }],
|
|
312
312
|
}));
|
|
313
313
|
|
|
314
314
|
describe('findAllFlat', () => {
|
|
@@ -327,6 +327,10 @@ describe('Test Comments service functions utils', () => {
|
|
|
327
327
|
expect(result).toHaveProperty('meta');
|
|
328
328
|
expect(result.data.length).toBe(4);
|
|
329
329
|
expect(result).toHaveProperty(['data', 0, 'content'], db[0].content);
|
|
330
|
+
expect(result).toHaveProperty(['data', 0, 'author']);
|
|
331
|
+
expect(result).toHaveProperty(['data', 0, 'author', 'id'], db[0].authorId);
|
|
332
|
+
expect(result).toHaveProperty(['data', 0, 'author', 'name'], db[0].authorName);
|
|
333
|
+
expect(result).toHaveProperty(['data', 0, 'author', 'email'], db[0].authorEmail);
|
|
330
334
|
expect(result).toHaveProperty(['data', 3, 'content'], db[3].content);
|
|
331
335
|
expect(result).toHaveProperty(['meta', 'pagination', 'page'], 1);
|
|
332
336
|
expect(result).toHaveProperty(['meta', 'pagination', 'pageSize'], 5);
|
|
@@ -370,6 +374,26 @@ describe('Test Comments service functions utils', () => {
|
|
|
370
374
|
expect(result[0].children.length).toBe(0);
|
|
371
375
|
});
|
|
372
376
|
});
|
|
377
|
+
|
|
378
|
+
describe('findOne', () => {
|
|
379
|
+
test('Should return proper structure', async () => {
|
|
380
|
+
const result = await getPluginService('common').findOne({ related });
|
|
381
|
+
expect(result).toHaveProperty('id', db[0].id);
|
|
382
|
+
expect(result).toHaveProperty('content', db[0].content);
|
|
383
|
+
expect(result).toHaveProperty(['author', 'id'], db[0].authorId);
|
|
384
|
+
expect(result).toHaveProperty(['author', 'name'], db[0].authorName);
|
|
385
|
+
expect(result).toHaveProperty(['author', 'email'], db[0].authorEmail);
|
|
386
|
+
});
|
|
387
|
+
});
|
|
388
|
+
|
|
389
|
+
describe('findRelatedEntitiesFor', () => {
|
|
390
|
+
test('Should return proper structure', async () => {
|
|
391
|
+
const result = await getPluginService('common').findRelatedEntitiesFor(db);
|
|
392
|
+
expect(result).toHaveProperty([0, 'id'], relatedEntity.id);
|
|
393
|
+
expect(result).toHaveProperty([0, 'title'], relatedEntity.title);
|
|
394
|
+
expect(result).toHaveProperty([0, 'uid'], relatedEntity.uid);
|
|
395
|
+
});
|
|
396
|
+
});
|
|
373
397
|
});
|
|
374
398
|
});
|
|
375
399
|
});
|