Workaround for empty server messages (typing indicator)
This commit is contained in:
@@ -250,6 +250,10 @@ impl<'a> Repository<'a> {
|
||||
Ok(())
|
||||
})?;
|
||||
|
||||
// TODO: May need to update conversation metadata here, but this has a perf impact.
|
||||
// Ideally we would consolidate this in the code above, assuming we're only inserting *new* messages, but
|
||||
// this may not necessarily be the case.
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
||||
@@ -325,8 +329,15 @@ impl<'a> Repository<'a> {
|
||||
conversation_guid,
|
||||
last_message
|
||||
);
|
||||
conversation.date = last_message.date;
|
||||
conversation.last_message_preview = Some(last_message.text.clone());
|
||||
|
||||
if last_message.date > conversation.date {
|
||||
conversation.date = last_message.date;
|
||||
}
|
||||
|
||||
if !last_message.text.is_empty() && !last_message.text.trim().is_empty() {
|
||||
conversation.last_message_preview = Some(last_message.text.clone());
|
||||
}
|
||||
|
||||
self.insert_conversation(conversation)?;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user