Repository navigation
A reply or edit ends, as on Esc, when its chat can no longer be written in - #306
Conversation
…ked; chats_loaded says why it ends them
Review (
|
|
Follow-up to the review: the guard is added (2ac8e61). This was the declined code suggestion; it's now done at the orchestrator's request.
|
What changed
A reply or an edit that is open when its chat can no longer be written in now ends. That covers a chat blocked from the sidebar, turned back into a request, or changed by a sync from the phone. It ends the way Esc ends it:
replyandstart_editingcheckhas_composer()first.How it's built:
ConversationsChanged→refresh_chats→set_chats). That is also the only place the list changes outside the demo. Soset_chatscalls a newchats_loaded, which askshas_composer()(A chat without a composer is read-only: its messages offer only Copy and Delete for Everyone #302) about the open chat. Without one, it ends the reply and the edit.edit_gonealready defersstop_editingfor this reason. That deferral is nowstop_editing_later, which both use.Why
Found in the review of #302. A reply or edit open when the chat lost its composer was kept, unseen. It came back when the chat had a composer again, possibly much later and in a different context.
How it was tested
Window test
actions::window_tests::a_reply_or_edit_ends_as_on_esc_when_its_chat_loses_its_composer. It was written first and failed at each step:blocked: the reply ends — left: Some("Replying to yourself"), right: None.blocked: the edit ends — left: Some("Editing message"), right: None.The test replies to our message in the Family group and types "half a reply", then:
chats_loadedswitched off: it fails at "blocked: the reply ends".reply's.Gate.
make format && make checkon 2ac8e61, which hasorigin/main32364a4 merged:cargo fmt --checkpasses.cargo clippy --all-targets -D warningspasses, plain and with--features hush-desktop/snapshot.cargo test --features hush-desktop/snapshotpasses (405 + 554 tests, 4 ignored as before).TZ=America/New_York. One test outside this PR,files::window_tests::a_click_on_a_file_presses_it_and_leaves_the_keys_in_the_composer, fails from 00:00 to about 01:30 local time onorigin/main's code too, because of a day line among the demo's files (see the review comment).Snapshots: none. Nothing drawn changed, and the bar that replaces the composer is A chat without a composer is read-only: its messages offer only Copy and Delete for Everyone #302's.
Not changed:
restore_reply). If the chat lost its composer in between, the reply would come back unseen. The core answers as soon as the message is stored and queued, so the window is one local database write. A failure on the network marks the message Failed and puts nothing back. This is left as is.Closes #303