From 219b41302e60e3e2d70a928e09bc9f93704c1952 Mon Sep 17 00:00:00 2001 From: Miodec Date: Mon, 27 Jan 2025 11:05:38 +0100 Subject: [PATCH] fix: only send ban event to the bot if the user was actually banned --- backend/src/dal/user.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/backend/src/dal/user.ts b/backend/src/dal/user.ts index cd50f7e0f..8ee5a655b 100644 --- a/backend/src/dal/user.ts +++ b/backend/src/dal/user.ts @@ -881,10 +881,12 @@ export async function recordAutoBanEvent( uid ); - const discordIdIsValid = - user.discordId !== undefined && user.discordId !== ""; - if (discordIdIsValid) { - await GeorgeQueue.userBanned(user.discordId as string, true); + if (banningUser) { + const discordIdIsValid = + user.discordId !== undefined && user.discordId !== ""; + if (discordIdIsValid) { + await GeorgeQueue.userBanned(user.discordId as string, true); + } } return ret;