Utilize EnvelopeRemove events
EnvelopeRemove events were not ever used in the UIasync
parent
efb06be09b
commit
bfbaf3d617
|
@ -1470,6 +1470,12 @@ impl Component for CompactListing {
|
|||
self.view
|
||||
.process_event(&mut UIEvent::EnvelopeRename(*old_hash, *new_hash), context);
|
||||
}
|
||||
UIEvent::EnvelopeRemove(ref _env_hash, ref thread_hash) => {
|
||||
if self.order.contains_key(thread_hash) {
|
||||
self.refresh_mailbox(context, false);
|
||||
self.set_dirty(true);
|
||||
}
|
||||
}
|
||||
UIEvent::EnvelopeUpdate(ref env_hash) => {
|
||||
let account = &context.accounts[self.cursor_pos.0];
|
||||
let threads = &account.collection.threads[&self.cursor_pos.1];
|
||||
|
|
|
@ -629,25 +629,30 @@ impl Account {
|
|||
Some(crate::types::NotificationType::NewMail),
|
||||
));
|
||||
}
|
||||
RefreshEventKind::Remove(envelope_hash) => {
|
||||
RefreshEventKind::Remove(env_hash) => {
|
||||
let thread_hash = {
|
||||
let thread_hash = self.collection.get_env(env_hash).thread();
|
||||
self.collection.threads[&mailbox_hash]
|
||||
.find_group(self.collection.threads[&mailbox_hash][&thread_hash].group)
|
||||
};
|
||||
#[cfg(feature = "sqlite3")]
|
||||
{
|
||||
let envelopes = self.collection.envelopes.read();
|
||||
let envelopes = envelopes.unwrap();
|
||||
if let Err(err) = crate::sqlite3::remove(envelope_hash) {
|
||||
if let Err(err) = crate::sqlite3::remove(env_hash) {
|
||||
melib::log(
|
||||
format!(
|
||||
"Failed to remove envelope {} [{}] in cache: {}",
|
||||
&envelopes[&envelope_hash].message_id_display(),
|
||||
envelope_hash,
|
||||
&envelopes[&env_hash].message_id_display(),
|
||||
env_hash,
|
||||
err.to_string()
|
||||
),
|
||||
melib::ERROR,
|
||||
);
|
||||
}
|
||||
}
|
||||
self.collection.remove(envelope_hash, mailbox_hash);
|
||||
return Some(EnvelopeRemove(envelope_hash));
|
||||
self.collection.remove(env_hash, mailbox_hash);
|
||||
return Some(EnvelopeRemove(env_hash, thread_hash));
|
||||
}
|
||||
RefreshEventKind::Rescan => {
|
||||
let handle = Account::new_worker(
|
||||
|
|
|
@ -39,7 +39,7 @@ use super::execute::Action;
|
|||
use super::terminal::*;
|
||||
|
||||
use melib::backends::{AccountHash, MailboxHash};
|
||||
use melib::{EnvelopeHash, RefreshEvent};
|
||||
use melib::{EnvelopeHash, RefreshEvent, ThreadHash};
|
||||
use nix::unistd::Pid;
|
||||
use std;
|
||||
use std::fmt;
|
||||
|
@ -119,7 +119,7 @@ pub enum UIEvent {
|
|||
RefreshEvent(Box<RefreshEvent>),
|
||||
EnvelopeUpdate(EnvelopeHash),
|
||||
EnvelopeRename(EnvelopeHash, EnvelopeHash), // old_hash, new_hash
|
||||
EnvelopeRemove(EnvelopeHash),
|
||||
EnvelopeRemove(EnvelopeHash, ThreadHash),
|
||||
Contacts(ContactEvent),
|
||||
Compose(ComposeEvent),
|
||||
FinishedUIDialog(crate::components::ComponentId, UIMessage),
|
||||
|
|
Loading…
Reference in New Issue