message-toolbar: Prevent sending empty messages

This commit is contained in:
Kévin Commaille 2023-11-15 10:14:10 +01:00
parent f358b0bb25
commit 09fb83a27c
No known key found for this signature in database
GPG key ID: 29A48C1F03620416

View file

@ -558,6 +558,11 @@ impl MessageToolbar {
formatted_body.replace_range(.."/me ".len(), ""); formatted_body.replace_range(.."/me ".len(), "");
} }
if plain_body.trim().is_empty() {
// Don't send empty message.
return;
}
let html_body = if is_markdown { let html_body = if is_markdown {
FormattedBody::markdown(formatted_body).map(|b| b.body) FormattedBody::markdown(formatted_body).map(|b| b.body)
} else if has_mentions { } else if has_mentions {