Don't allow empty chat messages

This commit is contained in:
Max Brunsfeld
2021-08-27 17:21:53 -07:00
parent a98d293f54
commit 18d175a240
2 changed files with 34 additions and 10 deletions
+4
View File
@@ -229,6 +229,10 @@ impl Channel {
body: String,
cx: &mut ModelContext<Self>,
) -> Result<Task<Result<()>>> {
if body.is_empty() {
Err(anyhow!("message body can't be empty"))?;
}
let channel_id = self.details.id;
let current_user_id = self.current_user_id()?;
let local_id = self.next_local_message_id;