feat: make senders tappable and replace the toasts with a fixed status line
This commit is contained in:
parent
22c20427f0
commit
8e9d2a92a6
3 changed files with 112 additions and 92 deletions
26
src/app.rs
26
src/app.rs
|
|
@ -525,14 +525,14 @@ impl Carrier {
|
|||
self.stash_draft();
|
||||
self.selected_own = false;
|
||||
self.selected_contact = Some(address);
|
||||
self.open = None;
|
||||
// The open message stays: the detail shows over it while
|
||||
// its list highlight holds, and picking it again returns.
|
||||
self.page = Page::Mail;
|
||||
}
|
||||
Message::OwnSelected => {
|
||||
self.stash_draft();
|
||||
self.selected_own = true;
|
||||
self.selected_contact = None;
|
||||
self.open = None;
|
||||
self.page = Page::Mail;
|
||||
}
|
||||
Message::FetchCancelled => {
|
||||
|
|
@ -1029,13 +1029,30 @@ mod tests {
|
|||
assert_eq!(app.busy.as_deref(), Some("fetching"));
|
||||
}
|
||||
|
||||
fn opened() -> OpenedMsg {
|
||||
OpenedMsg {
|
||||
id: "ab".repeat(32),
|
||||
from: String::new(),
|
||||
subject: String::new(),
|
||||
time: 0,
|
||||
body: String::new(),
|
||||
sender: String::new(),
|
||||
reply_to: None,
|
||||
kept: false,
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[test]
|
||||
fn contact_selection_and_message_selection_supersede_each_other() {
|
||||
let mut app = app();
|
||||
// An open message survives a contact selection: the detail pane
|
||||
// shows the contact while the mail keeps its list highlight.
|
||||
app.open = Some((Folder::Inbox, opened()));
|
||||
app.handle(Message::ContactSelected("bob@localhost".into()));
|
||||
assert_eq!(app.selected_contact.as_deref(), Some("bob@localhost"));
|
||||
assert_eq!(app.page, Page::Mail);
|
||||
assert!(app.open.is_none());
|
||||
assert!(app.open.is_some());
|
||||
|
||||
// busy does not block selecting a contact
|
||||
app.busy = Some("fetching".into());
|
||||
|
|
@ -1046,10 +1063,11 @@ mod tests {
|
|||
#[test]
|
||||
fn own_and_contact_selection_supersede_each_other() {
|
||||
let mut app = app();
|
||||
app.open = Some((Folder::Inbox, opened()));
|
||||
app.handle(Message::OwnSelected);
|
||||
assert!(app.selected_own);
|
||||
assert_eq!(app.page, Page::Mail);
|
||||
assert!(app.open.is_none());
|
||||
assert!(app.open.is_some());
|
||||
|
||||
app.handle(Message::ContactSelected("bob@localhost".into()));
|
||||
assert!(!app.selected_own);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue