Fix logic error in case creation for manual kicks

This commit is contained in:
Dragory 2020-12-19 02:59:41 +02:00
parent 14bebfe405
commit a60cb92b74
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -28,11 +28,10 @@ export const CreateKickCaseOnManualKickEvt = modActionsEvt(
);
if (kickAuditLogEntry) {
const existingCaseForThisEntry = await pluginData.state.cases.findByAuditLogId(kickAuditLogEntry.id);
let createdCase;
if (existingCaseForThisEntry) {
let createdCase = await pluginData.state.cases.findByAuditLogId(kickAuditLogEntry.id);
if (createdCase) {
logger.warn(
`Tried to create duplicate case for audit log entry ${kickAuditLogEntry.id}, existing case id ${existingCaseForThisEntry.id}`,
`Tried to create duplicate case for audit log entry ${kickAuditLogEntry.id}, existing case id ${createdCase.id}`,
);
} else {
const casesPlugin = pluginData.getPlugin(CasesPlugin);