ui/compose: don't save sent mail with Draft flag

jmap
Manos Pitsidianakis 2019-11-27 14:24:20 +02:00
parent 58209d6f6b
commit 8a17eee769
Signed by: Manos Pitsidianakis
GPG Key ID: 73627C2F690DF710
1 changed files with 15 additions and 9 deletions

View File

@ -358,7 +358,7 @@ impl Composer {
} }
} }
fn save_draft(&mut self, context: &mut Context, folder_type: SpecialUseMailbox) { fn save_draft(&mut self, context: &mut Context, folder_type: SpecialUseMailbox, flags: Flag) {
let mut failure = true; let mut failure = true;
let draft = std::mem::replace(&mut self.draft, Draft::default()); let draft = std::mem::replace(&mut self.draft, Draft::default());
@ -372,11 +372,9 @@ impl Composer {
continue; continue;
} }
let folder = folder.unwrap(); let folder = folder.unwrap();
if let Err(e) = context.accounts[self.account_cursor].save( if let Err(e) =
draft.as_bytes(), context.accounts[self.account_cursor].save(draft.as_bytes(), folder, Some(flags))
folder, {
Some(Flag::SEEN | Flag::DRAFT),
) {
debug!("{:?} could not save draft msg", e); debug!("{:?} could not save draft msg", e);
log( log(
format!( format!(
@ -636,12 +634,16 @@ impl Component for Composer {
self.account_cursor, self.account_cursor,
self.draft.clone(), self.draft.clone(),
) { ) {
self.save_draft(context, SpecialUseMailbox::Sent); self.save_draft(context, SpecialUseMailbox::Sent, Flag::SEEN);
context context
.replies .replies
.push_back(UIEvent::Action(Tab(Kill(self.id)))); .push_back(UIEvent::Action(Tab(Kill(self.id))));
} else { } else {
self.save_draft(context, SpecialUseMailbox::Drafts); self.save_draft(
context,
SpecialUseMailbox::Drafts,
Flag::SEEN | Flag::DRAFT,
);
} }
} }
} }
@ -684,7 +686,11 @@ impl Component for Composer {
} }
'n' => {} 'n' => {}
'y' => { 'y' => {
self.save_draft(context, SpecialUseMailbox::Drafts); self.save_draft(
context,
SpecialUseMailbox::Drafts,
Flag::SEEN | Flag::DRAFT,
);
context.replies.push_back(UIEvent::Action(Tab(Kill(u)))); context.replies.push_back(UIEvent::Action(Tab(Kill(u))));
return true; return true;
} }