Workaround for empty server messages (typing indicator)
This commit is contained in:
@@ -559,7 +559,15 @@ impl Daemon {
|
||||
let messages = client
|
||||
.get_messages(&conversation_id, None, None, last_message_id)
|
||||
.await?;
|
||||
let db_messages: Vec<kordophone_db::models::Message> = messages
|
||||
|
||||
// Filter messages that have an empty body, or a body that is just whitespace.
|
||||
// This is a workaround for a bug in the server where it returns messages with an empty body, which is usually
|
||||
// the typing indicator or stuff like that. In the future, we need to move to ChatItems instead of Messages.
|
||||
let insertable_messages: Vec<kordophone::model::Message> = messages
|
||||
.into_iter()
|
||||
.filter(|m| !m.text.is_empty() && !m.text.trim().is_empty()).collect();
|
||||
|
||||
let db_messages: Vec<kordophone_db::models::Message> = insertable_messages
|
||||
.into_iter()
|
||||
.map(kordophone_db::models::Message::from)
|
||||
.collect();
|
||||
|
||||
Reference in New Issue
Block a user