From 5d3097330d8b06704516f42b651a8bf13a6003da Mon Sep 17 00:00:00 2001 From: Carl Vitullo Date: Thu, 15 Jan 2026 16:31:08 -0500 Subject: [PATCH] Remove path that can cause duplicated user mod threads to be created It was trying to record things to the db, but tbh that's not really necessary here. Useful, but there's a lot of code rn that relies on having a message available, and there isn't one if it was blocked --- app/helpers/modLog.ts | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/app/helpers/modLog.ts b/app/helpers/modLog.ts index 6a1fbce..5693653 100644 --- a/app/helpers/modLog.ts +++ b/app/helpers/modLog.ts @@ -146,7 +146,6 @@ export const reportAutomod = async ({ guild, user, channelId, - messageId, ruleName, matchedKeyword, actionType, @@ -181,33 +180,6 @@ export const reportAutomod = async ({ allowedMentions: { roles: [moderator] }, }); - // Record to database if we have a messageId - if (messageId) { - await retry(3, async () => { - const result = await recordReport({ - reportedMessageId: messageId, - reportedChannelId: channelId ?? "unknown", - reportedUserId: user.id, - guildId: guild.id, - logMessageId: logMessage.id, - logChannelId: thread.id, - reason: ReportReasons.automod, - extra: `Rule: ${ruleName}`, - }); - - if (!result.wasInserted) { - log( - "warn", - "reportAutomod", - "duplicate detected at database level, retrying check", - ); - throw new Error("Race condition detected in recordReport, retrying…"); - } - - return result; - }); - } - // Forward to mod log await logMessage.forward(modLog).catch((e) => { log("error", "reportAutomod", "failed to forward to modLog", { error: e });