3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-05-18 15:45:03 +00:00

cases: add safeguard check for existing cases with the same audit log id

This commit is contained in:
Dragory 2020-06-04 02:37:13 +03:00
parent 97b26b63d0
commit efced7cc9f

View file

@ -94,6 +94,14 @@ export class CasesPlugin extends ZeppelinPlugin<TConfigSchema> {
ppName = `${pp.username}#${pp.discriminator}`;
}
if (args.auditLogId) {
const existingAuditLogCase = await this.cases.findByAuditLogId(args.auditLogId);
if (existingAuditLogCase) {
delete args.auditLogId;
logger.warn(`Duplicate audit log ID for mod case: ${args.auditLogId}`);
}
}
const createdCase = await this.cases.create({
type: args.type,
user_id: args.userId,