From 149b1db38c1a89d18657f610ba85f6cbecf196b8 Mon Sep 17 00:00:00 2001 From: simoleo89 Date: Sat, 13 Jun 2026 16:42:24 +0200 Subject: [PATCH] fix(mod-tools): default-sanction sent the topic array index, not the topic id sendDefaultSanction passed `selectedTopic` (the index into the topics array) as the CFH topic id to DefaultSanctionMessageComposer, so the emulator applied the default sanction against whatever topic happened to sit at that array position. The sibling sendSanction (and the topic label) correctly use `topics[selectedTopic].id`. Pass `category.id`, and move the `category` lookup after the `selectedTopic === -1` guard (+ a `!category` guard). --- .../mod-tools/views/user/ModToolsUserModActionView.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx index 76c265f..6a82f09 100644 --- a/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx +++ b/src/components/mod-tools/views/user/ModToolsUserModActionView.tsx @@ -75,14 +75,16 @@ export const ModToolsUserModActionView: FC = pro { if(isSendingRef.current) return; + if(selectedTopic === -1) return sendAlert(LocalizeText('modtools.user.modaction.error.no.topic')); + const category = topics[selectedTopic]; - if(selectedTopic === -1) return sendAlert(LocalizeText('modtools.user.modaction.error.no.topic')); + if(!category) return sendAlert(LocalizeText('modtools.user.modaction.error.no.topic')); const messageOrDefault = (message.trim().length === 0) ? LocalizeText(`help.cfh.topic.${ category.id }`) : message; isSendingRef.current = true; - SendMessageComposer(new DefaultSanctionMessageComposer(user.userId, selectedTopic, messageOrDefault)); + SendMessageComposer(new DefaultSanctionMessageComposer(user.userId, category.id, messageOrDefault)); onCloseClick(); };