kpcli: adds support for querying messages
This commit is contained in:
@@ -44,8 +44,8 @@ impl APIInterface for TestClient {
|
|||||||
Ok(self.conversations.clone())
|
Ok(self.conversations.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
async fn get_messages(&mut self, conversation: Conversation) -> Result<Vec<Message>, Self::Error> {
|
async fn get_messages(&mut self, conversation_id: &ConversationID) -> Result<Vec<Message>, Self::Error> {
|
||||||
if let Some(messages) = self.messages.get(&conversation.guid) {
|
if let Some(messages) = self.messages.get(conversation_id) {
|
||||||
return Ok(messages.clone())
|
return Ok(messages.clone())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,7 @@ impl From<kordophone_db::models::Conversation> for PrintableConversation {
|
|||||||
date: OffsetDateTime::from_unix_timestamp(value.date.and_utc().timestamp()).unwrap(),
|
date: OffsetDateTime::from_unix_timestamp(value.date.and_utc().timestamp()).unwrap(),
|
||||||
unread_count: value.unread_count.into(),
|
unread_count: value.unread_count.into(),
|
||||||
last_message_preview: value.last_message_preview,
|
last_message_preview: value.last_message_preview,
|
||||||
participants: value.participants.into_iter().map(|p| p.display_name).collect(),
|
participants: value.participants.into_iter().map(|p| p.display_name()).collect(),
|
||||||
display_name: value.display_name,
|
display_name: value.display_name,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user