From eb39a175df2819faf637c757dddcdd9d308d63ba Mon Sep 17 00:00:00 2001 From: James Ketrenos Date: Sun, 6 Oct 2024 11:51:01 -0700 Subject: [PATCH] Fix error if try to play victory point too early Block sending blank chat messages Signed-off-by: James Ketrenos --- server/routes/games.js | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/server/routes/games.js b/server/routes/games.js index 75c92b2..4633025 100755 --- a/server/routes/games.js +++ b/server/routes/games.js @@ -2363,8 +2363,7 @@ const playCard = (game, session, card) => { } }); if (points < getVictoryPointRule(game)) { - return `You can not play victory point cards until you can reach ` - `${getVictoryPointRule(game) }!`; + return `You can not play victory point cards until you can reach ${getVictoryPointRule(game)}!`; } addChatMessage(game, session, `${name} played a Victory Point card.`); } @@ -4109,7 +4108,11 @@ router.ws("/ws/:id", async (ws, req) => { break; case 'chat': - console.log(`${short}:${id} - ${data.type} - ${data.message}`) + /* If the chat message is empty, do not add it to the chat */ + if (data.message.trim() == '') { + break; + } + console.log(`${short}:${id} - ${data.type} - "${data.message}"`) addChatMessage(game, session, `${session.name}: ${data.message}`, true); parseChatCommands(game, data.message); sendUpdateToPlayers(game, { chat: game.chat });