mirror of
https://github.com/duckietm/Nitro-V3.git
synced 2026-06-19 23:16:21 +00:00
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).
This commit is contained in:
@@ -75,14 +75,16 @@ export const ModToolsUserModActionView: FC<ModToolsUserModActionViewProps> = 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();
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user