feat(tui): join outbox rows to chat rows by message id
All checks were successful
ci / test (pull_request) Successful in 4m12s
All checks were successful
ci / test (pull_request) Successful in 4m12s
`chat_with_delivery` matched pending outbox rows to chat rows by body because `store::Message` carried no id, so an older send that was still queued showed a delivered mark whenever a newer send of the same text had already crossed the circuit. `store::Message` now carries its `messages.id`, and the TUI joins `OutboxEntry::message_id` == `Message::id`. The body match and its newest-first fallback are gone. `list_messages()` keeps its signature; callers that do not need the id are untouched.
This commit is contained in:
parent
02b531625f
commit
2cbe7d41e5
4 changed files with 89 additions and 41 deletions
|
|
@ -83,6 +83,9 @@ pub struct FriendProfile {
|
|||
|
||||
#[derive(Debug)]
|
||||
pub struct Message {
|
||||
/// `messages.id` row id. The outbox row for a send carries the same
|
||||
/// `message_id`, so the UI can join exactly instead of matching bodies.
|
||||
pub id: i64,
|
||||
pub dir: String,
|
||||
pub plaintext: Vec<u8>,
|
||||
}
|
||||
|
|
@ -858,7 +861,11 @@ impl Store {
|
|||
let aad = message_aad(friend_id, &dir, id);
|
||||
let plaintext = crate::backup::aead_decrypt(&self.msg_key, &blob, &aad)
|
||||
.map_err(|_| Error("message decrypt failed".into()))?;
|
||||
out.push(Message { dir, plaintext });
|
||||
out.push(Message {
|
||||
id,
|
||||
dir,
|
||||
plaintext,
|
||||
});
|
||||
}
|
||||
Ok(out)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue