From 5c1b502a155bb902b6dce4a37a3d925afcb0d9ef Mon Sep 17 00:00:00 2001 From: Ajay Date: Sat, 28 Jan 2023 14:04:14 -0500 Subject: [PATCH] Fix ban users var not used --- src/routes/shadowBanUser.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/routes/shadowBanUser.ts b/src/routes/shadowBanUser.ts index b3e192d..80950d4 100644 --- a/src/routes/shadowBanUser.ts +++ b/src/routes/shadowBanUser.ts @@ -132,9 +132,12 @@ async function banIP(hashedIP: HashedIP, enabled: boolean, unHideOldSubmissions: //find all previous submissions and hide them if (unHideOldSubmissions) { const users = await unHideSubmissionsByIP(categories, hashedIP, type); - await Promise.all([...users].map((user) => { - return banUser(user, enabled, unHideOldSubmissions, type, categories); - })) + + if (banUsers) { + await Promise.all([...users].map((user) => { + return banUser(user, enabled, unHideOldSubmissions, type, categories); + })); + } } else if (row.userCount > 0) { // Nothing to do, and already added return 409;