From a60cb92b741075c872db6c42695fa42c69225147 Mon Sep 17 00:00:00 2001 From: Dragory <2606411+Dragory@users.noreply.github.com> Date: Sat, 19 Dec 2020 02:59:41 +0200 Subject: [PATCH] Fix logic error in case creation for manual kicks --- .../ModActions/events/CreateKickCaseOnManualKickEvt.ts | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/backend/src/plugins/ModActions/events/CreateKickCaseOnManualKickEvt.ts b/backend/src/plugins/ModActions/events/CreateKickCaseOnManualKickEvt.ts index e1527b2d..e97c6106 100644 --- a/backend/src/plugins/ModActions/events/CreateKickCaseOnManualKickEvt.ts +++ b/backend/src/plugins/ModActions/events/CreateKickCaseOnManualKickEvt.ts @@ -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);