mirror of
https://github.com/ZeppelinBot/Zeppelin.git
synced 2025-03-16 14:11:50 +00:00
cases: add safeguard check for existing cases with the same audit log id
This commit is contained in:
parent
69db410808
commit
ff9bcca350
1 changed files with 8 additions and 0 deletions
|
@ -94,6 +94,14 @@ export class CasesPlugin extends ZeppelinPlugin<TConfigSchema> {
|
||||||
ppName = `${pp.username}#${pp.discriminator}`;
|
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({
|
const createdCase = await this.cases.create({
|
||||||
type: args.type,
|
type: args.type,
|
||||||
user_id: args.userId,
|
user_id: args.userId,
|
||||||
|
|
Loading…
Add table
Reference in a new issue