[client] Polls: a poll is a message, a vote replaces the voter's earlier one, only the asker closes and the close carries the final votes; the client keeps each conversation's polls
This commit is contained in:
@@ -214,6 +214,13 @@ fn pair_and_talk_through_a_real_relay_which_never_sees_a_name_or_a_word() {
|
||||
};
|
||||
let out = jan.react(jan_side, mine, Some(emoji)).expect("react");
|
||||
jan.deliver(&out).expect("deliver");
|
||||
// And a poll (F28): its question and options neither.
|
||||
let question = "POLL-QUESTION-CANARY";
|
||||
let options = vec!["OPTION-CANARY-A".to_string(), "OPTION-CANARY-B".to_string()];
|
||||
let out = jan
|
||||
.compose_poll(jan_side, question, &options, false)
|
||||
.expect("poll");
|
||||
jan.deliver(&out).expect("deliver");
|
||||
|
||||
// Snapshot the database while both messages wait, before anyone fetches.
|
||||
let waiting = std::fs::read(&db).expect("db");
|
||||
@@ -240,6 +247,13 @@ fn pair_and_talk_through_a_real_relay_which_never_sees_a_name_or_a_word() {
|
||||
to: mine,
|
||||
emoji: Some(emoji.into()),
|
||||
},
|
||||
Event::Poll {
|
||||
contact: eva_side,
|
||||
seq: 2,
|
||||
question: question.into(),
|
||||
options: options.clone(),
|
||||
multiple: false,
|
||||
},
|
||||
]
|
||||
);
|
||||
let after = std::fs::read(&db).expect("db");
|
||||
@@ -248,6 +262,9 @@ fn pair_and_talk_through_a_real_relay_which_never_sees_a_name_or_a_word() {
|
||||
for (what, needle) in [
|
||||
("canary", canary.as_bytes()),
|
||||
("reaction", emoji.as_bytes()),
|
||||
("poll question", question.as_bytes()),
|
||||
("poll option", options[0].as_bytes()),
|
||||
("poll option", options[1].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()),
|
||||
|
||||
Reference in New Issue
Block a user