strapi-plugin-comments 3.0.3 → 3.0.5
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/dist/_chunks/{index-BUVqbcoe.js → index-BAXZ3d__.js} +2 -2
- package/dist/_chunks/{index-BMbvyf7_.js → index-BTWJ00Fw.js} +2 -2
- package/dist/_chunks/{index-DkFRVIkq.js → index-CJVLjLWX.js} +103 -119
- package/dist/_chunks/{index-CZsqxJsf.mjs → index-CK1XCSqz.mjs} +2 -2
- package/dist/_chunks/{index-BAKREpmX.mjs → index-DUWJDJLu.mjs} +2 -2
- package/dist/_chunks/{index-D_Yjpru0.js → index-DidQUJKN.js} +5 -5
- package/dist/_chunks/{index-CaFBMp1z.mjs → index-PCqyAKE7.mjs} +8 -3
- package/dist/_chunks/{index-BIcU6CkW.mjs → index-yhf78avJ.mjs} +5 -5
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/api/client.d.ts +5 -5
- package/dist/admin/src/api/schemas.d.ts +63 -63
- package/dist/admin/src/components/UserAvatar/index.d.ts +1 -1
- package/dist/admin/src/hooks/useAPI.d.ts +5 -5
- package/dist/admin/src/hooks/useCommentsAll.d.ts +1 -1
- package/dist/admin/src/hooks/useReports.d.ts +1 -1
- package/dist/server/index.js +60 -20
- package/dist/server/index.mjs +60 -20
- package/dist/server/src/controllers/index.d.ts +526 -1
- package/dist/server/src/index.d.ts +2284 -181
- package/dist/server/src/repositories/comment.repository.d.ts +2 -0
- package/dist/server/src/services/admin/admin.service.d.ts +527 -1
- package/dist/server/src/services/admin/utils.d.ts +9 -1
- package/dist/server/src/services/client.service.d.ts +527 -1
- package/dist/server/src/services/common.service.d.ts +2 -1
- package/dist/server/src/services/index.d.ts +1803 -225
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +527 -2
- package/package.json +1 -1
package/dist/server/index.js
CHANGED
|
@@ -8185,6 +8185,19 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
8185
8185
|
}
|
|
8186
8186
|
];
|
|
8187
8187
|
await strapi2.admin.services.permission.actionProvider.registerMany(actions);
|
|
8188
|
+
const commonService2 = getPluginService(strapi2, "common");
|
|
8189
|
+
const enabledCollections = await commonService2.getConfig(CONFIG_PARAMS.ENABLED_COLLECTIONS, []);
|
|
8190
|
+
if (enabledCollections.length) {
|
|
8191
|
+
strapi2.db.lifecycles.subscribe({
|
|
8192
|
+
models: enabledCollections,
|
|
8193
|
+
afterDelete: async (event) => {
|
|
8194
|
+
const uid = event.model.uid;
|
|
8195
|
+
const { documentId, locale } = event.result;
|
|
8196
|
+
const relation = [uid, documentId].join(":");
|
|
8197
|
+
await commonService2.perRemove(relation, locale);
|
|
8198
|
+
}
|
|
8199
|
+
});
|
|
8200
|
+
}
|
|
8188
8201
|
};
|
|
8189
8202
|
const defaultPluginConfig = {
|
|
8190
8203
|
isValidationEnabled: true,
|
|
@@ -8438,7 +8451,7 @@ const getCommentSchema = (enabledCollections) => {
|
|
|
8438
8451
|
relation: getRelationValidator(enabledCollections),
|
|
8439
8452
|
content: zod.z.string().min(1),
|
|
8440
8453
|
author: externalAuthorSchema.optional(),
|
|
8441
|
-
threadOf: zod.z.string().optional(),
|
|
8454
|
+
threadOf: zod.z.union([zod.z.string(), zod.z.number()]).optional(),
|
|
8442
8455
|
approvalStatus: zod.z.nativeEnum(APPROVAL_STATUS).optional(),
|
|
8443
8456
|
locale: zod.z.string().optional()
|
|
8444
8457
|
});
|
|
@@ -8469,7 +8482,18 @@ const getBaseFindSchema = (enabledCollections) => {
|
|
|
8469
8482
|
sort: orderByValidator.optional().nullable().default("createdAt:desc"),
|
|
8470
8483
|
fields: zod.z.string().array().optional(),
|
|
8471
8484
|
omit: zod.z.string().array().optional(),
|
|
8472
|
-
filters: getFiltersOperators({
|
|
8485
|
+
filters: getFiltersOperators({
|
|
8486
|
+
id: true,
|
|
8487
|
+
content: true,
|
|
8488
|
+
authorId: true,
|
|
8489
|
+
authorName: true,
|
|
8490
|
+
authorEmail: true,
|
|
8491
|
+
createdAt: true,
|
|
8492
|
+
updatedAt: true,
|
|
8493
|
+
removed: true,
|
|
8494
|
+
blocked: true,
|
|
8495
|
+
blockedThread: true
|
|
8496
|
+
}).optional(),
|
|
8473
8497
|
isAdmin: zod.z.boolean().optional().default(false),
|
|
8474
8498
|
populate: zod.z.record(zod.z.union([zod.z.boolean(), zod.z.object({ populate: zod.z.boolean() })])).optional(),
|
|
8475
8499
|
limit: stringToNumberValidator.optional(),
|
|
@@ -8539,7 +8563,7 @@ const reportAbuseValidator = (config2, payload) => {
|
|
|
8539
8563
|
const getRemoveCommentSchema = (enabledCollections) => {
|
|
8540
8564
|
return zod.z.object({
|
|
8541
8565
|
relation: getRelationValidator(enabledCollections),
|
|
8542
|
-
commentId: zod.z.number(),
|
|
8566
|
+
commentId: zod.z.union([zod.z.string(), zod.z.number()]),
|
|
8543
8567
|
authorId: zod.z.union([zod.z.string(), zod.z.number()])
|
|
8544
8568
|
});
|
|
8545
8569
|
};
|
|
@@ -8875,6 +8899,9 @@ const getCommentRepositorySource = (strapi2) => {
|
|
|
8875
8899
|
const isValidationEnabled = await getConfig(strapi2, "isValidationEnabled", false);
|
|
8876
8900
|
return strapi2.query(modelUid).delete(params).then((result) => result ? shouldValidateObject(isValidationEnabled, commentResultValidator.findOne)(result) : null);
|
|
8877
8901
|
},
|
|
8902
|
+
async deleteMany(params) {
|
|
8903
|
+
return strapi2.query(modelUid).deleteMany(params);
|
|
8904
|
+
},
|
|
8878
8905
|
updateMany(params) {
|
|
8879
8906
|
return strapi2.query(modelUid).updateMany(params);
|
|
8880
8907
|
},
|
|
@@ -9565,7 +9592,11 @@ const getAdminServiceUtils = lodashExports.once((strapi2) => {
|
|
|
9565
9592
|
getPopulate() {
|
|
9566
9593
|
return {
|
|
9567
9594
|
authorUser: getDefaultAuthorPopulate(strapi2),
|
|
9568
|
-
threadOf:
|
|
9595
|
+
threadOf: {
|
|
9596
|
+
populate: {
|
|
9597
|
+
authorUser: getDefaultAuthorPopulate(strapi2)
|
|
9598
|
+
}
|
|
9599
|
+
},
|
|
9569
9600
|
reports: {
|
|
9570
9601
|
where: {
|
|
9571
9602
|
resolved: false
|
|
@@ -9742,7 +9773,8 @@ const adminServices = ({ strapi: strapi2 }) => {
|
|
|
9742
9773
|
},
|
|
9743
9774
|
...defaultPopulate,
|
|
9744
9775
|
startingFromId: levelThreadId,
|
|
9745
|
-
isAdmin: true
|
|
9776
|
+
isAdmin: true,
|
|
9777
|
+
limit: Number.MAX_SAFE_INTEGER
|
|
9746
9778
|
},
|
|
9747
9779
|
false
|
|
9748
9780
|
);
|
|
@@ -9976,7 +10008,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9976
10008
|
);
|
|
9977
10009
|
const threadData = await tryCatch(
|
|
9978
10010
|
async () => {
|
|
9979
|
-
return threadOf ? await this.getCommonService().findOne({ id: threadOf, related: relation, locale }) : null;
|
|
10011
|
+
return threadOf ? await this.getCommonService().findOne({ id: threadOf, related: relation, locale: locale || null }) : null;
|
|
9980
10012
|
},
|
|
9981
10013
|
new PluginError2(400, "Thread does not exist")
|
|
9982
10014
|
);
|
|
@@ -9999,10 +10031,11 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9999
10031
|
const comment2 = await getCommentRepository(strapi2).create({
|
|
10000
10032
|
data: {
|
|
10001
10033
|
...authorData,
|
|
10034
|
+
threadOf,
|
|
10035
|
+
locale,
|
|
10002
10036
|
content: clearContent,
|
|
10003
10037
|
related: relation,
|
|
10004
|
-
approvalStatus: isApprovalFlowEnabled ? APPROVAL_STATUS.PENDING : null
|
|
10005
|
-
locale
|
|
10038
|
+
approvalStatus: isApprovalFlowEnabled ? APPROVAL_STATUS.PENDING : null
|
|
10006
10039
|
},
|
|
10007
10040
|
populate: {
|
|
10008
10041
|
authorUser: true
|
|
@@ -10225,7 +10258,7 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10225
10258
|
return { uid, relatedId: relatedStringId };
|
|
10226
10259
|
},
|
|
10227
10260
|
isValidUserContext(user) {
|
|
10228
|
-
return
|
|
10261
|
+
return user ? user.id != void 0 : true;
|
|
10229
10262
|
},
|
|
10230
10263
|
sanitizeCommentEntity(entity, blockedAuthors, omitProps = [], populate = {}) {
|
|
10231
10264
|
const fieldsToPopulate = Array.isArray(populate) ? populate : Object.keys(populate || {});
|
|
@@ -10265,20 +10298,17 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10265
10298
|
sort: { [operator]: direction },
|
|
10266
10299
|
select: Array.isArray(fields) ? lodashExports.uniq([...fields, defaultSelect].flat()) : fields
|
|
10267
10300
|
};
|
|
10268
|
-
const
|
|
10301
|
+
const params = {
|
|
10269
10302
|
where: {
|
|
10270
10303
|
...filters,
|
|
10271
10304
|
...locale ? { locale } : {}
|
|
10272
10305
|
},
|
|
10273
10306
|
populate: populateClause,
|
|
10274
10307
|
...fieldsQuery,
|
|
10275
|
-
|
|
10276
|
-
|
|
10277
|
-
}
|
|
10278
|
-
|
|
10279
|
-
if (pagination?.withCount) {
|
|
10280
|
-
paginationData = await getCommentRepository(strapi2).findWithCount({ where: { ...filters, ...locale ? { locale } : {} } }).then((result2) => result2.pagination);
|
|
10281
|
-
}
|
|
10308
|
+
pageSize: pagination?.pageSize || limit || PAGE_SIZE,
|
|
10309
|
+
page: pagination?.page || (skip ? Math.floor(skip / limit) : 1) || 1
|
|
10310
|
+
};
|
|
10311
|
+
const { results: entries, pagination: resultPaginationData } = await getCommentRepository(strapi2).findWithCount(params);
|
|
10282
10312
|
const entriesWithThreads = await Promise.all(
|
|
10283
10313
|
entries.map(async (_2) => {
|
|
10284
10314
|
const { results, pagination: { total } } = await getCommentRepository(strapi2).findWithCount({
|
|
@@ -10317,7 +10347,7 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10317
10347
|
});
|
|
10318
10348
|
return {
|
|
10319
10349
|
data: hasRelatedEntitiesToMap ? result.map((_2) => this.mergeRelatedEntityTo(_2, relatedEntities)) : result,
|
|
10320
|
-
pagination:
|
|
10350
|
+
pagination: resultPaginationData
|
|
10321
10351
|
};
|
|
10322
10352
|
},
|
|
10323
10353
|
// Find comments and create relations tree structure
|
|
@@ -10330,9 +10360,10 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10330
10360
|
dropBlockedThreads,
|
|
10331
10361
|
isAdmin = false,
|
|
10332
10362
|
omit = [],
|
|
10333
|
-
locale
|
|
10363
|
+
locale,
|
|
10364
|
+
limit
|
|
10334
10365
|
}, relatedEntity) {
|
|
10335
|
-
const entities = await this.findAllFlat({ filters, populate, sort, fields, isAdmin, omit, locale }, relatedEntity);
|
|
10366
|
+
const entities = await this.findAllFlat({ filters, populate, sort, fields, isAdmin, omit, locale, limit }, relatedEntity);
|
|
10336
10367
|
return buildNestedStructure(
|
|
10337
10368
|
entities?.data,
|
|
10338
10369
|
startingFromId,
|
|
@@ -10494,6 +10525,15 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10494
10525
|
}
|
|
10495
10526
|
return content;
|
|
10496
10527
|
},
|
|
10528
|
+
async perRemove(related, locale) {
|
|
10529
|
+
const defaultLocale = await strapi2.plugin("i18n")?.service("locales").getDefaultLocale() || null;
|
|
10530
|
+
return getCommentRepository(strapi2).deleteMany({
|
|
10531
|
+
where: {
|
|
10532
|
+
related,
|
|
10533
|
+
$or: [{ locale }, defaultLocale === locale ? { locale: { $eq: null } } : null].filter(Boolean)
|
|
10534
|
+
}
|
|
10535
|
+
});
|
|
10536
|
+
},
|
|
10497
10537
|
registerLifecycleHook() {
|
|
10498
10538
|
},
|
|
10499
10539
|
async runLifecycleHook() {
|
package/dist/server/index.mjs
CHANGED
|
@@ -8184,6 +8184,19 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
8184
8184
|
}
|
|
8185
8185
|
];
|
|
8186
8186
|
await strapi2.admin.services.permission.actionProvider.registerMany(actions);
|
|
8187
|
+
const commonService2 = getPluginService(strapi2, "common");
|
|
8188
|
+
const enabledCollections = await commonService2.getConfig(CONFIG_PARAMS.ENABLED_COLLECTIONS, []);
|
|
8189
|
+
if (enabledCollections.length) {
|
|
8190
|
+
strapi2.db.lifecycles.subscribe({
|
|
8191
|
+
models: enabledCollections,
|
|
8192
|
+
afterDelete: async (event) => {
|
|
8193
|
+
const uid = event.model.uid;
|
|
8194
|
+
const { documentId, locale } = event.result;
|
|
8195
|
+
const relation = [uid, documentId].join(":");
|
|
8196
|
+
await commonService2.perRemove(relation, locale);
|
|
8197
|
+
}
|
|
8198
|
+
});
|
|
8199
|
+
}
|
|
8187
8200
|
};
|
|
8188
8201
|
const defaultPluginConfig = {
|
|
8189
8202
|
isValidationEnabled: true,
|
|
@@ -8437,7 +8450,7 @@ const getCommentSchema = (enabledCollections) => {
|
|
|
8437
8450
|
relation: getRelationValidator(enabledCollections),
|
|
8438
8451
|
content: z.string().min(1),
|
|
8439
8452
|
author: externalAuthorSchema.optional(),
|
|
8440
|
-
threadOf: z.string().optional(),
|
|
8453
|
+
threadOf: z.union([z.string(), z.number()]).optional(),
|
|
8441
8454
|
approvalStatus: z.nativeEnum(APPROVAL_STATUS).optional(),
|
|
8442
8455
|
locale: z.string().optional()
|
|
8443
8456
|
});
|
|
@@ -8468,7 +8481,18 @@ const getBaseFindSchema = (enabledCollections) => {
|
|
|
8468
8481
|
sort: orderByValidator.optional().nullable().default("createdAt:desc"),
|
|
8469
8482
|
fields: z.string().array().optional(),
|
|
8470
8483
|
omit: z.string().array().optional(),
|
|
8471
|
-
filters: getFiltersOperators({
|
|
8484
|
+
filters: getFiltersOperators({
|
|
8485
|
+
id: true,
|
|
8486
|
+
content: true,
|
|
8487
|
+
authorId: true,
|
|
8488
|
+
authorName: true,
|
|
8489
|
+
authorEmail: true,
|
|
8490
|
+
createdAt: true,
|
|
8491
|
+
updatedAt: true,
|
|
8492
|
+
removed: true,
|
|
8493
|
+
blocked: true,
|
|
8494
|
+
blockedThread: true
|
|
8495
|
+
}).optional(),
|
|
8472
8496
|
isAdmin: z.boolean().optional().default(false),
|
|
8473
8497
|
populate: z.record(z.union([z.boolean(), z.object({ populate: z.boolean() })])).optional(),
|
|
8474
8498
|
limit: stringToNumberValidator.optional(),
|
|
@@ -8538,7 +8562,7 @@ const reportAbuseValidator = (config2, payload) => {
|
|
|
8538
8562
|
const getRemoveCommentSchema = (enabledCollections) => {
|
|
8539
8563
|
return z.object({
|
|
8540
8564
|
relation: getRelationValidator(enabledCollections),
|
|
8541
|
-
commentId: z.number(),
|
|
8565
|
+
commentId: z.union([z.string(), z.number()]),
|
|
8542
8566
|
authorId: z.union([z.string(), z.number()])
|
|
8543
8567
|
});
|
|
8544
8568
|
};
|
|
@@ -8874,6 +8898,9 @@ const getCommentRepositorySource = (strapi2) => {
|
|
|
8874
8898
|
const isValidationEnabled = await getConfig(strapi2, "isValidationEnabled", false);
|
|
8875
8899
|
return strapi2.query(modelUid).delete(params).then((result) => result ? shouldValidateObject(isValidationEnabled, commentResultValidator.findOne)(result) : null);
|
|
8876
8900
|
},
|
|
8901
|
+
async deleteMany(params) {
|
|
8902
|
+
return strapi2.query(modelUid).deleteMany(params);
|
|
8903
|
+
},
|
|
8877
8904
|
updateMany(params) {
|
|
8878
8905
|
return strapi2.query(modelUid).updateMany(params);
|
|
8879
8906
|
},
|
|
@@ -9564,7 +9591,11 @@ const getAdminServiceUtils = lodashExports.once((strapi2) => {
|
|
|
9564
9591
|
getPopulate() {
|
|
9565
9592
|
return {
|
|
9566
9593
|
authorUser: getDefaultAuthorPopulate(strapi2),
|
|
9567
|
-
threadOf:
|
|
9594
|
+
threadOf: {
|
|
9595
|
+
populate: {
|
|
9596
|
+
authorUser: getDefaultAuthorPopulate(strapi2)
|
|
9597
|
+
}
|
|
9598
|
+
},
|
|
9568
9599
|
reports: {
|
|
9569
9600
|
where: {
|
|
9570
9601
|
resolved: false
|
|
@@ -9741,7 +9772,8 @@ const adminServices = ({ strapi: strapi2 }) => {
|
|
|
9741
9772
|
},
|
|
9742
9773
|
...defaultPopulate,
|
|
9743
9774
|
startingFromId: levelThreadId,
|
|
9744
|
-
isAdmin: true
|
|
9775
|
+
isAdmin: true,
|
|
9776
|
+
limit: Number.MAX_SAFE_INTEGER
|
|
9745
9777
|
},
|
|
9746
9778
|
false
|
|
9747
9779
|
);
|
|
@@ -9975,7 +10007,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9975
10007
|
);
|
|
9976
10008
|
const threadData = await tryCatch(
|
|
9977
10009
|
async () => {
|
|
9978
|
-
return threadOf ? await this.getCommonService().findOne({ id: threadOf, related: relation, locale }) : null;
|
|
10010
|
+
return threadOf ? await this.getCommonService().findOne({ id: threadOf, related: relation, locale: locale || null }) : null;
|
|
9979
10011
|
},
|
|
9980
10012
|
new PluginError2(400, "Thread does not exist")
|
|
9981
10013
|
);
|
|
@@ -9998,10 +10030,11 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9998
10030
|
const comment2 = await getCommentRepository(strapi2).create({
|
|
9999
10031
|
data: {
|
|
10000
10032
|
...authorData,
|
|
10033
|
+
threadOf,
|
|
10034
|
+
locale,
|
|
10001
10035
|
content: clearContent,
|
|
10002
10036
|
related: relation,
|
|
10003
|
-
approvalStatus: isApprovalFlowEnabled ? APPROVAL_STATUS.PENDING : null
|
|
10004
|
-
locale
|
|
10037
|
+
approvalStatus: isApprovalFlowEnabled ? APPROVAL_STATUS.PENDING : null
|
|
10005
10038
|
},
|
|
10006
10039
|
populate: {
|
|
10007
10040
|
authorUser: true
|
|
@@ -10224,7 +10257,7 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10224
10257
|
return { uid, relatedId: relatedStringId };
|
|
10225
10258
|
},
|
|
10226
10259
|
isValidUserContext(user) {
|
|
10227
|
-
return
|
|
10260
|
+
return user ? user.id != void 0 : true;
|
|
10228
10261
|
},
|
|
10229
10262
|
sanitizeCommentEntity(entity, blockedAuthors, omitProps = [], populate = {}) {
|
|
10230
10263
|
const fieldsToPopulate = Array.isArray(populate) ? populate : Object.keys(populate || {});
|
|
@@ -10264,20 +10297,17 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10264
10297
|
sort: { [operator]: direction },
|
|
10265
10298
|
select: Array.isArray(fields) ? lodashExports.uniq([...fields, defaultSelect].flat()) : fields
|
|
10266
10299
|
};
|
|
10267
|
-
const
|
|
10300
|
+
const params = {
|
|
10268
10301
|
where: {
|
|
10269
10302
|
...filters,
|
|
10270
10303
|
...locale ? { locale } : {}
|
|
10271
10304
|
},
|
|
10272
10305
|
populate: populateClause,
|
|
10273
10306
|
...fieldsQuery,
|
|
10274
|
-
|
|
10275
|
-
|
|
10276
|
-
}
|
|
10277
|
-
|
|
10278
|
-
if (pagination?.withCount) {
|
|
10279
|
-
paginationData = await getCommentRepository(strapi2).findWithCount({ where: { ...filters, ...locale ? { locale } : {} } }).then((result2) => result2.pagination);
|
|
10280
|
-
}
|
|
10307
|
+
pageSize: pagination?.pageSize || limit || PAGE_SIZE,
|
|
10308
|
+
page: pagination?.page || (skip ? Math.floor(skip / limit) : 1) || 1
|
|
10309
|
+
};
|
|
10310
|
+
const { results: entries, pagination: resultPaginationData } = await getCommentRepository(strapi2).findWithCount(params);
|
|
10281
10311
|
const entriesWithThreads = await Promise.all(
|
|
10282
10312
|
entries.map(async (_2) => {
|
|
10283
10313
|
const { results, pagination: { total } } = await getCommentRepository(strapi2).findWithCount({
|
|
@@ -10316,7 +10346,7 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10316
10346
|
});
|
|
10317
10347
|
return {
|
|
10318
10348
|
data: hasRelatedEntitiesToMap ? result.map((_2) => this.mergeRelatedEntityTo(_2, relatedEntities)) : result,
|
|
10319
|
-
pagination:
|
|
10349
|
+
pagination: resultPaginationData
|
|
10320
10350
|
};
|
|
10321
10351
|
},
|
|
10322
10352
|
// Find comments and create relations tree structure
|
|
@@ -10329,9 +10359,10 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10329
10359
|
dropBlockedThreads,
|
|
10330
10360
|
isAdmin = false,
|
|
10331
10361
|
omit = [],
|
|
10332
|
-
locale
|
|
10362
|
+
locale,
|
|
10363
|
+
limit
|
|
10333
10364
|
}, relatedEntity) {
|
|
10334
|
-
const entities = await this.findAllFlat({ filters, populate, sort, fields, isAdmin, omit, locale }, relatedEntity);
|
|
10365
|
+
const entities = await this.findAllFlat({ filters, populate, sort, fields, isAdmin, omit, locale, limit }, relatedEntity);
|
|
10335
10366
|
return buildNestedStructure(
|
|
10336
10367
|
entities?.data,
|
|
10337
10368
|
startingFromId,
|
|
@@ -10493,6 +10524,15 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10493
10524
|
}
|
|
10494
10525
|
return content;
|
|
10495
10526
|
},
|
|
10527
|
+
async perRemove(related, locale) {
|
|
10528
|
+
const defaultLocale = await strapi2.plugin("i18n")?.service("locales").getDefaultLocale() || null;
|
|
10529
|
+
return getCommentRepository(strapi2).deleteMany({
|
|
10530
|
+
where: {
|
|
10531
|
+
related,
|
|
10532
|
+
$or: [{ locale }, defaultLocale === locale ? { locale: { $eq: null } } : null].filter(Boolean)
|
|
10533
|
+
}
|
|
10534
|
+
});
|
|
10535
|
+
},
|
|
10496
10536
|
registerLifecycleHook() {
|
|
10497
10537
|
},
|
|
10498
10538
|
async runLifecycleHook() {
|