From b52a35a734fedca20b06454c36eb816e5e56703c Mon Sep 17 00:00:00 2001 From: hippoz <10706925-hippoz@users.noreply.gitlab.com> Date: Wed, 9 Aug 2023 20:31:08 +0300 Subject: [PATCH] trim whitespace before sending message --- frontend/src/components/MessageInput.svelte | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/MessageInput.svelte b/frontend/src/components/MessageInput.svelte index b040f18..d236e47 100644 --- a/frontend/src/components/MessageInput.svelte +++ b/frontend/src/components/MessageInput.svelte @@ -98,9 +98,9 @@ const sendMessage = async () => { messageTextarea.focus(); - const content = messageInput; + const content = messageInput.trim(); - if (content.trim() === "" || !userInfoStore.value) + if (!content.length || !userInfoStore.value) return; // optimistically add message to store