Don't fetch messages that arrived in the meantime if InboxWatch is

disabled and re-enabled

That's another narrow-stitching patch for a scenario where many emails could
be deleted all at once and surprisingly: user disables inbox-watch, enables delete-from-server, after a moth enables inbox-watch again -> currently all emails that arrived in the meantime will be deleted (if emails are not fetched, they won't be deleted)
This commit is contained in:
Hocuri
2020-11-17 13:17:04 +01:00
parent c8d4eee794
commit 3a7bd8b49d
2 changed files with 44 additions and 42 deletions

View File

@@ -253,6 +253,16 @@ impl Context {
job::schedule_resync(self).await;
ret
}
Config::InboxWatch => {
if self.get_config(Config::InboxWatch).await.as_deref() != value {
// If Inbox-watch is disabled and then enabled again, we don't want
// emails that arrived in the meantime to be fetched
if let Some(inbox) = self.get_config(Config::ConfiguredInboxFolder).await {
crate::imap::set_config_last_seen_uid(self, inbox, 0, 0).await;
}
}
self.sql.set_raw_config(self, key, value).await
}
_ => self.sql.set_raw_config(self, key, value).await,
}
}