From 09fb83a27c47598d8a20b0ceb73d965614b97ccf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Commaille?= Date: Wed, 15 Nov 2023 10:14:10 +0100 Subject: [PATCH] message-toolbar: Prevent sending empty messages --- src/session/view/content/room_history/message_toolbar/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/session/view/content/room_history/message_toolbar/mod.rs b/src/session/view/content/room_history/message_toolbar/mod.rs index a2b164b2..f4aafb5f 100644 --- a/src/session/view/content/room_history/message_toolbar/mod.rs +++ b/src/session/view/content/room_history/message_toolbar/mod.rs @@ -558,6 +558,11 @@ impl MessageToolbar { formatted_body.replace_range(.."/me ".len(), ""); } + if plain_body.trim().is_empty() { + // Don't send empty message. + return; + } + let html_body = if is_markdown { FormattedBody::markdown(formatted_body).map(|b| b.body) } else if has_mentions {