From e98a544553d853c574bc9ea789626ce69e79ac8c Mon Sep 17 00:00:00 2001 From: Mia <49593536+mia-pi-git@users.noreply.github.com> Date: Sun, 27 Oct 2024 16:34:01 -0500 Subject: [PATCH] Suspects: Don't re-send suspect-create on test edit --- server/chat-plugins/suspect-tests.ts | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/server/chat-plugins/suspect-tests.ts b/server/chat-plugins/suspect-tests.ts index 2848ea18115b..2a09752d849e 100644 --- a/server/chat-plugins/suspect-tests.ts +++ b/server/chat-plugins/suspect-tests.ts @@ -99,14 +99,16 @@ export const commands: Chat.ChatCommands = { } reqData[k] = val; } - - const [out, error] = await LoginServer.request("suspects/add", { - format: format.id, - reqs: JSON.stringify(reqData), - url: urlActual, - }); - if (out?.actionerror || error) { - throw new Chat.ErrorMessage("Error adding suspect test: " + (out?.actionerror || error?.message)); + const isEdit = suspectTests.suspects[format.id]; + if (!isEdit) { + const [out, error] = await LoginServer.request("suspects/add", { + format: format.id, + reqs: JSON.stringify(reqData), + url: urlActual, + }); + if (out?.actionerror || error) { + throw new Chat.ErrorMessage("Error adding suspect test: " + (out?.actionerror || error?.message)); + } } this.privateGlobalModAction(`${user.name} ${suspectTests.suspects[format.id] ? "edited the" : "added a"} ${format.name} suspect test.`);