strapi-plugin-comments 3.0.0 → 3.0.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.
- package/README.md +1 -1
- package/dist/_chunks/{index-B-ygLKrb.js → index-7Geqfcar.js} +31 -13
- package/dist/_chunks/{index-D8uskGzQ.js → index-BoLOt7pX.js} +2 -2
- package/dist/_chunks/{index-CIqMAf50.mjs → index-CIBI9Is6.mjs} +117 -96
- package/dist/_chunks/{index-BgN4aUMA.mjs → index-ChxSaqbf.mjs} +2 -2
- package/dist/_chunks/{index-DFAPx7Bl.js → index-CiJKS9C3.js} +1 -1
- package/dist/_chunks/{index-Bx2boY6h.mjs → index-Ct7A5TFY.mjs} +55 -37
- package/dist/_chunks/{index-CWfr5ejx.js → index-Czdnz9Ci.js} +55 -16
- package/dist/_chunks/{index-Db2zwbpe.mjs → index-JWxk4wBa.mjs} +55 -16
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/server/index.js +38 -38
- package/dist/server/index.mjs +38 -38
- package/dist/server/src/controllers/client.controller.d.ts +4 -1
- package/dist/server/src/controllers/index.d.ts +5 -2
- package/dist/server/src/index.d.ts +13 -4
- package/dist/server/src/services/client.service.d.ts +1 -1
- package/dist/server/src/services/index.d.ts +8 -2
- package/dist/server/src/validators/api/controllers/client.controller.validator.d.ts +7 -1
- package/dist/server/src/validators/utils.d.ts +4 -4
- package/package.json +7 -7
package/dist/server/index.js
CHANGED
|
@@ -8381,9 +8381,9 @@ const getRelationValidator = (enabledCollections) => zod.z.string().regex(REGEX$
|
|
|
8381
8381
|
"Invalid relation or not enabled collections"
|
|
8382
8382
|
);
|
|
8383
8383
|
const externalAuthorSchema = zod.z.object({
|
|
8384
|
-
id: zod.z.number(),
|
|
8384
|
+
id: zod.z.union([zod.z.number(), zod.z.string()]),
|
|
8385
8385
|
name: zod.z.string().min(1).max(100).optional(),
|
|
8386
|
-
email: zod.z.string().email()
|
|
8386
|
+
email: zod.z.string().email(),
|
|
8387
8387
|
avatar: zod.z.string().url().optional()
|
|
8388
8388
|
});
|
|
8389
8389
|
zod.z.union([zod.z.string(), zod.z.number(), zod.z.boolean()]);
|
|
@@ -8451,7 +8451,7 @@ const newCommentValidator = (enabledCollections, relation, payload) => {
|
|
|
8451
8451
|
};
|
|
8452
8452
|
const updateCommentValidator = (enabledCollections, payload) => {
|
|
8453
8453
|
return validate(
|
|
8454
|
-
getCommentSchema(enabledCollections).pick({ content: true, relation: true }).merge(getStringToNumberValidator({ commentId: AVAILABLE_OPERATORS.single })).safeParse(payload)
|
|
8454
|
+
getCommentSchema(enabledCollections).pick({ content: true, relation: true, author: true }).merge(getStringToNumberValidator({ commentId: AVAILABLE_OPERATORS.single })).safeParse(payload)
|
|
8455
8455
|
);
|
|
8456
8456
|
};
|
|
8457
8457
|
const getRelationSchema = (enabledCollections) => zod.z.object({
|
|
@@ -9027,8 +9027,9 @@ const controllers$1 = ({ strapi: strapi2 }) => ({
|
|
|
9027
9027
|
if (isRight(configResult)) {
|
|
9028
9028
|
const config2 = unwrapEither(configResult);
|
|
9029
9029
|
const result = updateCommentValidator(config2.enabledCollections, {
|
|
9030
|
-
...ctx.
|
|
9031
|
-
|
|
9030
|
+
...ctx.params,
|
|
9031
|
+
content: ctx.request.body.content,
|
|
9032
|
+
author: ctx.request.body.author
|
|
9032
9033
|
});
|
|
9033
9034
|
if (isRight(result)) {
|
|
9034
9035
|
return await this.getService("client").update(
|
|
@@ -9730,10 +9731,10 @@ const adminServices = ({ strapi: strapi2 }) => {
|
|
|
9730
9731
|
}
|
|
9731
9732
|
return { ..._2, uid };
|
|
9732
9733
|
});
|
|
9733
|
-
const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.
|
|
9734
|
+
const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.id : null;
|
|
9734
9735
|
const entitiesOnSameLevel = await this.getCommonService().findAllInHierarchy(
|
|
9735
9736
|
{
|
|
9736
|
-
|
|
9737
|
+
filters: {
|
|
9737
9738
|
...defaultWhere,
|
|
9738
9739
|
...query,
|
|
9739
9740
|
threadOf: levelThreadId,
|
|
@@ -9983,8 +9984,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9983
9984
|
throw unwrapEither(threadData);
|
|
9984
9985
|
}
|
|
9985
9986
|
const linkToThread = unwrapEither(threadData);
|
|
9986
|
-
|
|
9987
|
-
if (!isValidContext) {
|
|
9987
|
+
if (!author && !this.getCommonService().isValidUserContext(user)) {
|
|
9988
9988
|
throw resolveUserContextError(user);
|
|
9989
9989
|
}
|
|
9990
9990
|
const clearContent = await this.getCommonService().checkBadWords(content);
|
|
@@ -10021,19 +10021,22 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
10021
10021
|
return sanitizedEntity;
|
|
10022
10022
|
},
|
|
10023
10023
|
// Update a comment
|
|
10024
|
-
async update({ commentId, content }, user) {
|
|
10025
|
-
|
|
10026
|
-
if (!validContext) {
|
|
10024
|
+
async update({ commentId, content, author, relation }, user) {
|
|
10025
|
+
if (!author && !this.getCommonService().isValidUserContext(user)) {
|
|
10027
10026
|
throw resolveUserContextError(user);
|
|
10028
10027
|
}
|
|
10028
|
+
const authorId = user?.id || author?.id;
|
|
10029
10029
|
if (await this.getCommonService().checkBadWords(content)) {
|
|
10030
10030
|
const blockedAuthorProps = await this.getCommonService().getConfig(CONFIG_PARAMS$1.AUTHOR_BLOCKED_PROPS, []);
|
|
10031
|
-
const
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10036
|
-
|
|
10031
|
+
const existingComment = await this.getCommonService().findOne({ id: commentId, related: relation });
|
|
10032
|
+
if (existingComment && existingComment.author?.id?.toString() === authorId?.toString()) {
|
|
10033
|
+
const entity = await getCommentRepository(strapi2).update({
|
|
10034
|
+
where: { id: commentId },
|
|
10035
|
+
data: { content },
|
|
10036
|
+
populate: { threadOf: true, authorUser: true }
|
|
10037
|
+
});
|
|
10038
|
+
return this.getCommonService().sanitizeCommentEntity(entity, blockedAuthorProps);
|
|
10039
|
+
}
|
|
10037
10040
|
}
|
|
10038
10041
|
},
|
|
10039
10042
|
// Report abuse in comment
|
|
@@ -10084,7 +10087,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
10084
10087
|
}
|
|
10085
10088
|
},
|
|
10086
10089
|
async markAsRemoved({ commentId, relation, authorId }, user) {
|
|
10087
|
-
if (!this.getCommonService().isValidUserContext(user)) {
|
|
10090
|
+
if (!authorId && !this.getCommonService().isValidUserContext(user)) {
|
|
10088
10091
|
throw resolveUserContextError(user);
|
|
10089
10092
|
}
|
|
10090
10093
|
const author = user?.id || authorId;
|
|
@@ -10347,12 +10350,10 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10347
10350
|
authorUser: true
|
|
10348
10351
|
}
|
|
10349
10352
|
});
|
|
10350
|
-
console.log("findOne::entity", entity);
|
|
10351
10353
|
if (!entity) {
|
|
10352
10354
|
throw new PluginError$1(400, "Comment does not exist. Check your payload please.");
|
|
10353
10355
|
}
|
|
10354
10356
|
const doNotPopulateAuthor = await this.getConfig(CONFIG_PARAMS.AUTHOR_BLOCKED_PROPS, []);
|
|
10355
|
-
console.log("doNotPopulateAuthor", doNotPopulateAuthor);
|
|
10356
10357
|
const item = this.sanitizeCommentEntity(entity, doNotPopulateAuthor);
|
|
10357
10358
|
return filterOurResolvedReports(item);
|
|
10358
10359
|
},
|
|
@@ -10420,23 +10421,22 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10420
10421
|
);
|
|
10421
10422
|
return Promise.all(
|
|
10422
10423
|
Object.entries(data).map(
|
|
10423
|
-
async ([relatedUid, { documentIds, locale }]) =>
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
|
|
10439
|
-
)
|
|
10424
|
+
async ([relatedUid, { documentIds, locale }]) => {
|
|
10425
|
+
return Promise.all(
|
|
10426
|
+
documentIds.map(
|
|
10427
|
+
(documentId, index2) => strapi2.documents(relatedUid).findOne({
|
|
10428
|
+
documentId: documentId.toString(),
|
|
10429
|
+
locale: !lodashExports.isNil(locale[index2]) ? locale[index2] : void 0,
|
|
10430
|
+
status: "published"
|
|
10431
|
+
})
|
|
10432
|
+
)
|
|
10433
|
+
).then(
|
|
10434
|
+
(relatedEntities) => relatedEntities.filter((_2) => _2).map((_2) => ({
|
|
10435
|
+
..._2,
|
|
10436
|
+
uid: relatedUid
|
|
10437
|
+
}))
|
|
10438
|
+
);
|
|
10439
|
+
}
|
|
10440
10440
|
)
|
|
10441
10441
|
).then((result) => result.flat(2));
|
|
10442
10442
|
},
|
package/dist/server/index.mjs
CHANGED
|
@@ -8380,9 +8380,9 @@ const getRelationValidator = (enabledCollections) => z.string().regex(REGEX$1.re
|
|
|
8380
8380
|
"Invalid relation or not enabled collections"
|
|
8381
8381
|
);
|
|
8382
8382
|
const externalAuthorSchema = z.object({
|
|
8383
|
-
id: z.number(),
|
|
8383
|
+
id: z.union([z.number(), z.string()]),
|
|
8384
8384
|
name: z.string().min(1).max(100).optional(),
|
|
8385
|
-
email: z.string().email()
|
|
8385
|
+
email: z.string().email(),
|
|
8386
8386
|
avatar: z.string().url().optional()
|
|
8387
8387
|
});
|
|
8388
8388
|
z.union([z.string(), z.number(), z.boolean()]);
|
|
@@ -8450,7 +8450,7 @@ const newCommentValidator = (enabledCollections, relation, payload) => {
|
|
|
8450
8450
|
};
|
|
8451
8451
|
const updateCommentValidator = (enabledCollections, payload) => {
|
|
8452
8452
|
return validate(
|
|
8453
|
-
getCommentSchema(enabledCollections).pick({ content: true, relation: true }).merge(getStringToNumberValidator({ commentId: AVAILABLE_OPERATORS.single })).safeParse(payload)
|
|
8453
|
+
getCommentSchema(enabledCollections).pick({ content: true, relation: true, author: true }).merge(getStringToNumberValidator({ commentId: AVAILABLE_OPERATORS.single })).safeParse(payload)
|
|
8454
8454
|
);
|
|
8455
8455
|
};
|
|
8456
8456
|
const getRelationSchema = (enabledCollections) => z.object({
|
|
@@ -9026,8 +9026,9 @@ const controllers$1 = ({ strapi: strapi2 }) => ({
|
|
|
9026
9026
|
if (isRight(configResult)) {
|
|
9027
9027
|
const config2 = unwrapEither(configResult);
|
|
9028
9028
|
const result = updateCommentValidator(config2.enabledCollections, {
|
|
9029
|
-
...ctx.
|
|
9030
|
-
|
|
9029
|
+
...ctx.params,
|
|
9030
|
+
content: ctx.request.body.content,
|
|
9031
|
+
author: ctx.request.body.author
|
|
9031
9032
|
});
|
|
9032
9033
|
if (isRight(result)) {
|
|
9033
9034
|
return await this.getService("client").update(
|
|
@@ -9729,10 +9730,10 @@ const adminServices = ({ strapi: strapi2 }) => {
|
|
|
9729
9730
|
}
|
|
9730
9731
|
return { ..._2, uid };
|
|
9731
9732
|
});
|
|
9732
|
-
const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.
|
|
9733
|
+
const levelThreadId = entity.threadOf && typeof entity.threadOf === "object" ? entity.threadOf.id : null;
|
|
9733
9734
|
const entitiesOnSameLevel = await this.getCommonService().findAllInHierarchy(
|
|
9734
9735
|
{
|
|
9735
|
-
|
|
9736
|
+
filters: {
|
|
9736
9737
|
...defaultWhere,
|
|
9737
9738
|
...query,
|
|
9738
9739
|
threadOf: levelThreadId,
|
|
@@ -9982,8 +9983,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
9982
9983
|
throw unwrapEither(threadData);
|
|
9983
9984
|
}
|
|
9984
9985
|
const linkToThread = unwrapEither(threadData);
|
|
9985
|
-
|
|
9986
|
-
if (!isValidContext) {
|
|
9986
|
+
if (!author && !this.getCommonService().isValidUserContext(user)) {
|
|
9987
9987
|
throw resolveUserContextError(user);
|
|
9988
9988
|
}
|
|
9989
9989
|
const clearContent = await this.getCommonService().checkBadWords(content);
|
|
@@ -10020,19 +10020,22 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
10020
10020
|
return sanitizedEntity;
|
|
10021
10021
|
},
|
|
10022
10022
|
// Update a comment
|
|
10023
|
-
async update({ commentId, content }, user) {
|
|
10024
|
-
|
|
10025
|
-
if (!validContext) {
|
|
10023
|
+
async update({ commentId, content, author, relation }, user) {
|
|
10024
|
+
if (!author && !this.getCommonService().isValidUserContext(user)) {
|
|
10026
10025
|
throw resolveUserContextError(user);
|
|
10027
10026
|
}
|
|
10027
|
+
const authorId = user?.id || author?.id;
|
|
10028
10028
|
if (await this.getCommonService().checkBadWords(content)) {
|
|
10029
10029
|
const blockedAuthorProps = await this.getCommonService().getConfig(CONFIG_PARAMS$1.AUTHOR_BLOCKED_PROPS, []);
|
|
10030
|
-
const
|
|
10031
|
-
|
|
10032
|
-
|
|
10033
|
-
|
|
10034
|
-
|
|
10035
|
-
|
|
10030
|
+
const existingComment = await this.getCommonService().findOne({ id: commentId, related: relation });
|
|
10031
|
+
if (existingComment && existingComment.author?.id?.toString() === authorId?.toString()) {
|
|
10032
|
+
const entity = await getCommentRepository(strapi2).update({
|
|
10033
|
+
where: { id: commentId },
|
|
10034
|
+
data: { content },
|
|
10035
|
+
populate: { threadOf: true, authorUser: true }
|
|
10036
|
+
});
|
|
10037
|
+
return this.getCommonService().sanitizeCommentEntity(entity, blockedAuthorProps);
|
|
10038
|
+
}
|
|
10036
10039
|
}
|
|
10037
10040
|
},
|
|
10038
10041
|
// Report abuse in comment
|
|
@@ -10083,7 +10086,7 @@ const clientService = ({ strapi: strapi2 }) => {
|
|
|
10083
10086
|
}
|
|
10084
10087
|
},
|
|
10085
10088
|
async markAsRemoved({ commentId, relation, authorId }, user) {
|
|
10086
|
-
if (!this.getCommonService().isValidUserContext(user)) {
|
|
10089
|
+
if (!authorId && !this.getCommonService().isValidUserContext(user)) {
|
|
10087
10090
|
throw resolveUserContextError(user);
|
|
10088
10091
|
}
|
|
10089
10092
|
const author = user?.id || authorId;
|
|
@@ -10346,12 +10349,10 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10346
10349
|
authorUser: true
|
|
10347
10350
|
}
|
|
10348
10351
|
});
|
|
10349
|
-
console.log("findOne::entity", entity);
|
|
10350
10352
|
if (!entity) {
|
|
10351
10353
|
throw new PluginError$1(400, "Comment does not exist. Check your payload please.");
|
|
10352
10354
|
}
|
|
10353
10355
|
const doNotPopulateAuthor = await this.getConfig(CONFIG_PARAMS.AUTHOR_BLOCKED_PROPS, []);
|
|
10354
|
-
console.log("doNotPopulateAuthor", doNotPopulateAuthor);
|
|
10355
10356
|
const item = this.sanitizeCommentEntity(entity, doNotPopulateAuthor);
|
|
10356
10357
|
return filterOurResolvedReports(item);
|
|
10357
10358
|
},
|
|
@@ -10419,23 +10420,22 @@ const commonService = ({ strapi: strapi2 }) => ({
|
|
|
10419
10420
|
);
|
|
10420
10421
|
return Promise.all(
|
|
10421
10422
|
Object.entries(data).map(
|
|
10422
|
-
async ([relatedUid, { documentIds, locale }]) =>
|
|
10423
|
-
|
|
10424
|
-
|
|
10425
|
-
|
|
10426
|
-
|
|
10427
|
-
|
|
10428
|
-
|
|
10429
|
-
|
|
10430
|
-
|
|
10431
|
-
|
|
10432
|
-
|
|
10433
|
-
|
|
10434
|
-
|
|
10435
|
-
|
|
10436
|
-
|
|
10437
|
-
|
|
10438
|
-
)
|
|
10423
|
+
async ([relatedUid, { documentIds, locale }]) => {
|
|
10424
|
+
return Promise.all(
|
|
10425
|
+
documentIds.map(
|
|
10426
|
+
(documentId, index2) => strapi2.documents(relatedUid).findOne({
|
|
10427
|
+
documentId: documentId.toString(),
|
|
10428
|
+
locale: !lodashExports.isNil(locale[index2]) ? locale[index2] : void 0,
|
|
10429
|
+
status: "published"
|
|
10430
|
+
})
|
|
10431
|
+
)
|
|
10432
|
+
).then(
|
|
10433
|
+
(relatedEntities) => relatedEntities.filter((_2) => _2).map((_2) => ({
|
|
10434
|
+
..._2,
|
|
10435
|
+
uid: relatedUid
|
|
10436
|
+
}))
|
|
10437
|
+
);
|
|
10438
|
+
}
|
|
10439
10439
|
)
|
|
10440
10440
|
).then((result) => result.flat(2));
|
|
10441
10441
|
},
|
|
@@ -724,7 +724,10 @@ declare const controllers: ({ strapi }: StrapiContext) => {
|
|
|
724
724
|
total?: number;
|
|
725
725
|
};
|
|
726
726
|
}>;
|
|
727
|
-
put(ctx: RequestContext
|
|
727
|
+
put(ctx: RequestContext<{
|
|
728
|
+
content: string;
|
|
729
|
+
author: unknown;
|
|
730
|
+
}>): Promise<{
|
|
728
731
|
id?: number;
|
|
729
732
|
documentId?: string;
|
|
730
733
|
content?: string;
|
|
@@ -1439,7 +1439,7 @@ declare const controllers: {
|
|
|
1439
1439
|
locale?: string;
|
|
1440
1440
|
author?: {
|
|
1441
1441
|
name?: string;
|
|
1442
|
-
id?: number;
|
|
1442
|
+
id?: string | number;
|
|
1443
1443
|
email?: string;
|
|
1444
1444
|
avatar?: string;
|
|
1445
1445
|
};
|
|
@@ -2505,7 +2505,10 @@ declare const controllers: {
|
|
|
2505
2505
|
total?: number;
|
|
2506
2506
|
};
|
|
2507
2507
|
}>;
|
|
2508
|
-
put(ctx: import("../@types").RequestContext
|
|
2508
|
+
put(ctx: import("../@types").RequestContext<{
|
|
2509
|
+
content: string;
|
|
2510
|
+
author: unknown;
|
|
2511
|
+
}>): Promise<{
|
|
2509
2512
|
id?: number;
|
|
2510
2513
|
documentId?: string;
|
|
2511
2514
|
content?: string;
|
|
@@ -1509,7 +1509,7 @@ declare const _default: {
|
|
|
1509
1509
|
locale?: string;
|
|
1510
1510
|
author?: {
|
|
1511
1511
|
name?: string;
|
|
1512
|
-
id?: number;
|
|
1512
|
+
id?: string | number;
|
|
1513
1513
|
email?: string;
|
|
1514
1514
|
avatar?: string;
|
|
1515
1515
|
};
|
|
@@ -2575,7 +2575,10 @@ declare const _default: {
|
|
|
2575
2575
|
total?: number;
|
|
2576
2576
|
};
|
|
2577
2577
|
}>;
|
|
2578
|
-
put(ctx: import("./@types").RequestContext
|
|
2578
|
+
put(ctx: import("./@types").RequestContext<{
|
|
2579
|
+
content: string;
|
|
2580
|
+
author: unknown;
|
|
2581
|
+
}>): Promise<{
|
|
2579
2582
|
id?: number;
|
|
2580
2583
|
documentId?: string;
|
|
2581
2584
|
content?: string;
|
|
@@ -7737,7 +7740,7 @@ declare const _default: {
|
|
|
7737
7740
|
locale?: string;
|
|
7738
7741
|
author?: {
|
|
7739
7742
|
name?: string;
|
|
7740
|
-
id?: number;
|
|
7743
|
+
id?: string | number;
|
|
7741
7744
|
email?: string;
|
|
7742
7745
|
avatar?: string;
|
|
7743
7746
|
};
|
|
@@ -7819,8 +7822,14 @@ declare const _default: {
|
|
|
7819
7822
|
author?: any;
|
|
7820
7823
|
};
|
|
7821
7824
|
}>;
|
|
7822
|
-
update({ commentId, content }: {
|
|
7825
|
+
update({ commentId, content, author, relation }: {
|
|
7823
7826
|
content?: string;
|
|
7827
|
+
author?: {
|
|
7828
|
+
name?: string;
|
|
7829
|
+
id?: string | number;
|
|
7830
|
+
email?: string;
|
|
7831
|
+
avatar?: string;
|
|
7832
|
+
};
|
|
7824
7833
|
relation?: `${string}::${string}.${string}`;
|
|
7825
7834
|
commentId?: number;
|
|
7826
7835
|
}, user?: import("./@types").AdminUser): Promise<{
|
|
@@ -1976,7 +1976,7 @@ export declare const clientService: ({ strapi }: StrapiContext) => {
|
|
|
1976
1976
|
author?: any;
|
|
1977
1977
|
};
|
|
1978
1978
|
}>;
|
|
1979
|
-
update({ commentId, content }: client.UpdateCommentValidatorSchema, user?: AdminUser): Promise<{
|
|
1979
|
+
update({ commentId, content, author, relation }: client.UpdateCommentValidatorSchema, user?: AdminUser): Promise<{
|
|
1980
1980
|
id?: number;
|
|
1981
1981
|
documentId?: string;
|
|
1982
1982
|
content?: string;
|
|
@@ -4713,7 +4713,7 @@ declare const pluginServices: {
|
|
|
4713
4713
|
locale?: string;
|
|
4714
4714
|
author?: {
|
|
4715
4715
|
name?: string;
|
|
4716
|
-
id?: number;
|
|
4716
|
+
id?: string | number;
|
|
4717
4717
|
email?: string;
|
|
4718
4718
|
avatar?: string;
|
|
4719
4719
|
};
|
|
@@ -4795,8 +4795,14 @@ declare const pluginServices: {
|
|
|
4795
4795
|
author?: any;
|
|
4796
4796
|
};
|
|
4797
4797
|
}>;
|
|
4798
|
-
update({ commentId, content }: {
|
|
4798
|
+
update({ commentId, content, author, relation }: {
|
|
4799
4799
|
content?: string;
|
|
4800
|
+
author?: {
|
|
4801
|
+
name?: string;
|
|
4802
|
+
id?: string | number;
|
|
4803
|
+
email?: string;
|
|
4804
|
+
avatar?: string;
|
|
4805
|
+
};
|
|
4800
4806
|
relation?: `${string}::${string}.${string}`;
|
|
4801
4807
|
commentId?: number;
|
|
4802
4808
|
}, user?: import("../@types").AdminUser): Promise<{
|
|
@@ -7,7 +7,7 @@ export declare const newCommentValidator: (enabledCollections: string[], relatio
|
|
|
7
7
|
locale?: string;
|
|
8
8
|
author?: {
|
|
9
9
|
name?: string;
|
|
10
|
-
id?: number;
|
|
10
|
+
id?: string | number;
|
|
11
11
|
email?: string;
|
|
12
12
|
avatar?: string;
|
|
13
13
|
};
|
|
@@ -17,6 +17,12 @@ export declare const newCommentValidator: (enabledCollections: string[], relatio
|
|
|
17
17
|
export type NewCommentValidatorSchema = ExtractRightEither<ReturnType<typeof newCommentValidator>>;
|
|
18
18
|
export declare const updateCommentValidator: (enabledCollections: string[], payload: object) => import("../../../utils/Either").Left<import("../../../utils/PluginError").default> | import("../../../utils/Either").Right<{
|
|
19
19
|
content?: string;
|
|
20
|
+
author?: {
|
|
21
|
+
name?: string;
|
|
22
|
+
id?: string | number;
|
|
23
|
+
email?: string;
|
|
24
|
+
avatar?: string;
|
|
25
|
+
};
|
|
20
26
|
relation?: `${string}::${string}.${string}`;
|
|
21
27
|
commentId?: number;
|
|
22
28
|
}>;
|
|
@@ -757,18 +757,18 @@ export declare const queryPaginationSchema: z.ZodObject<z.objectUtil.extendShape
|
|
|
757
757
|
export declare const validate: <I, O>(result: z.SafeParseReturnType<I, O>) => import("../utils/Either").Left<PluginError> | import("../utils/Either").Right<O>;
|
|
758
758
|
export declare const getRelationValidator: (enabledCollections: string[]) => z.ZodEffects<z.ZodString, `${string}::${string}.${string}`, string>;
|
|
759
759
|
export declare const externalAuthorSchema: z.ZodObject<{
|
|
760
|
-
id: z.ZodNumber
|
|
760
|
+
id: z.ZodUnion<[z.ZodNumber, z.ZodString]>;
|
|
761
761
|
name: z.ZodOptional<z.ZodString>;
|
|
762
|
-
email: z.
|
|
762
|
+
email: z.ZodString;
|
|
763
763
|
avatar: z.ZodOptional<z.ZodString>;
|
|
764
764
|
}, "strip", z.ZodTypeAny, {
|
|
765
765
|
name?: string;
|
|
766
|
-
id?: number;
|
|
766
|
+
id?: string | number;
|
|
767
767
|
email?: string;
|
|
768
768
|
avatar?: string;
|
|
769
769
|
}, {
|
|
770
770
|
name?: string;
|
|
771
|
-
id?: number;
|
|
771
|
+
id?: string | number;
|
|
772
772
|
email?: string;
|
|
773
773
|
avatar?: string;
|
|
774
774
|
}>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-plugin-comments",
|
|
3
|
-
"version": "3.0.
|
|
3
|
+
"version": "3.0.2",
|
|
4
4
|
"description": "Strapi - Comments plugin",
|
|
5
5
|
"strapi": {
|
|
6
6
|
"name": "comments",
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@jest/types": "29.5.x",
|
|
69
69
|
"@sensinum/strapi-utils": "^1.0.4",
|
|
70
|
-
"@strapi/plugin-cloud": "^5.
|
|
71
|
-
"@strapi/plugin-graphql": "5.
|
|
72
|
-
"@strapi/plugin-users-permissions": "^5.
|
|
70
|
+
"@strapi/plugin-cloud": "^5.7.0",
|
|
71
|
+
"@strapi/plugin-graphql": "5.7.0",
|
|
72
|
+
"@strapi/plugin-users-permissions": "^5.7.0",
|
|
73
73
|
"@strapi/sdk-plugin": "^5.2.8",
|
|
74
|
-
"@strapi/strapi": "^5.
|
|
75
|
-
"@strapi/types": "^5.
|
|
74
|
+
"@strapi/strapi": "^5.7.0",
|
|
75
|
+
"@strapi/types": "^5.7.0",
|
|
76
76
|
"@types/jest": "^29.5.12",
|
|
77
77
|
"@types/koa": "^2.15.0",
|
|
78
78
|
"@types/react": "^18.3.8",
|
|
@@ -90,7 +90,7 @@
|
|
|
90
90
|
},
|
|
91
91
|
"peerDependencies": {
|
|
92
92
|
"@strapi/sdk-plugin": "^5.2.8",
|
|
93
|
-
"@strapi/strapi": "^5.
|
|
93
|
+
"@strapi/strapi": "^5.7.0",
|
|
94
94
|
"react": "^18.3.1",
|
|
95
95
|
"react-dom": "^18.3.1",
|
|
96
96
|
"react-router-dom": "^6.26.2",
|