[client] Reactions and replies: a message is named by its author and seq, a reply carries its reference, a reaction sets or removes, a newer kind is Unsupported

This commit is contained in:
2026-11-21 20:02:51 +01:00
parent 1d7f08927d
commit 9d9d63c02b
9 changed files with 875 additions and 31 deletions
+25 -5
View File
@@ -206,6 +206,14 @@ fn pair_and_talk_through_a_real_relay_which_never_sees_a_name_or_a_word() {
let canary = "CANARY-relay-test-4b2e-never-in-the-database";
eva.send(eva_side, canary).expect("send");
jan.send(jan_side, &format!("re: {canary}")).expect("send");
// A reaction (F27) waits with them: its emoji must not be readable either.
let emoji = "🦜CANARY🦜";
let mine = MessageRef {
author: jan.author(),
seq: 1,
};
let out = jan.react(jan_side, mine, Some(emoji)).expect("react");
jan.deliver(&out).expect("deliver");
// Snapshot the database while both messages wait, before anyone fetches.
let waiting = std::fs::read(&db).expect("db");
@@ -213,21 +221,33 @@ fn pair_and_talk_through_a_real_relay_which_never_sees_a_name_or_a_word() {
jan.poll().expect("poll"),
vec![Event::Message {
contact: jan_side,
text: canary.into()
text: canary.into(),
seq: 1,
reply_to: None,
}]
);
assert_eq!(
eva.poll().expect("poll"),
vec![Event::Message {
contact: eva_side,
text: format!("re: {canary}")
}]
vec![
Event::Message {
contact: eva_side,
text: format!("re: {canary}"),
seq: 1,
reply_to: None,
},
Event::Reaction {
contact: eva_side,
to: mine,
emoji: Some(emoji.into()),
},
]
);
let after = std::fs::read(&db).expect("db");
for snapshot in [&invited, &waiting, &after] {
for (what, needle) in [
("canary", canary.as_bytes()),
("reaction", emoji.as_bytes()),
("inviter's name", "Eva Nováková".as_bytes()),
("invitee's name", "Jan Dvořák".as_bytes()),
("invite secret", invite.secret.as_bytes().as_slice()),