Checks if the messages with given IDs exist. Returns IDs of existing messages.
(&self, account_id: u32, msg_ids: Vec<u32>)
| 1420 | /// |
| 1421 | /// Returns IDs of existing messages. |
| 1422 | async fn get_existing_msg_ids(&self, account_id: u32, msg_ids: Vec<u32>) -> Result<Vec<u32>> { |
| 1423 | if let Some(context) = self.get_context_opt(account_id).await { |
| 1424 | let msg_ids: Vec<MsgId> = msg_ids.into_iter().map(MsgId::new).collect(); |
| 1425 | let existing_msg_ids = get_existing_msg_ids(&context, &msg_ids).await?; |
| 1426 | Ok(existing_msg_ids |
| 1427 | .into_iter() |
| 1428 | .map(|msg_id| msg_id.to_u32()) |
| 1429 | .collect()) |
| 1430 | } else { |
| 1431 | // Account does not exist, so messages do not exist either, |
| 1432 | // but this is not an error. |
| 1433 | Ok(Vec::new()) |
| 1434 | } |
| 1435 | } |
| 1436 | |
| 1437 | /// Get all messages belonging to a chat. |
| 1438 | /// |
no test coverage detected