Skip to content

Commit

Permalink
Suspects: Allow editing reqs on existing test
Browse files Browse the repository at this point in the history
  • Loading branch information
mia-pi-git committed Oct 27, 2024
1 parent e98a544 commit 8f868a1
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions server/chat-plugins/suspect-tests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,16 +99,13 @@ export const commands: Chat.ChatCommands = {
}
reqData[k] = val;
}
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));
}
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.`);
Expand Down

0 comments on commit 8f868a1

Please sign in to comment.