mirror of
https://github.com/chatmail/core.git
synced 2026-05-19 23:06:32 +03:00
schedule_resync() instead of deleting imap_sync
This commit is contained in:
@@ -351,13 +351,6 @@ impl Context {
|
|||||||
pub(crate) async fn set_primary_self_addr(&self, primary_new: &str) -> Result<()> {
|
pub(crate) async fn set_primary_self_addr(&self, primary_new: &str) -> Result<()> {
|
||||||
let primary_new = addr_normalize(primary_new).to_lowercase();
|
let primary_new = addr_normalize(primary_new).to_lowercase();
|
||||||
|
|
||||||
if self.get_primary_self_addr().await.ok().as_deref() != Some(&primary_new) {
|
|
||||||
// Make sure that all server UIDs will be resynced
|
|
||||||
self.sql
|
|
||||||
.execute("DELETE FROM imap_sync;", paramsv![])
|
|
||||||
.await?;
|
|
||||||
}
|
|
||||||
|
|
||||||
// add old primary address (if exists) to secondary addresses
|
// add old primary address (if exists) to secondary addresses
|
||||||
let mut secondary_addrs = self.get_all_self_addrs().await?;
|
let mut secondary_addrs = self.get_all_self_addrs().await?;
|
||||||
|
|
||||||
|
|||||||
@@ -453,6 +453,12 @@ async fn configure(ctx: &Context, param: &mut LoginParam) -> Result<()> {
|
|||||||
drop(imap);
|
drop(imap);
|
||||||
|
|
||||||
progress!(ctx, 910);
|
progress!(ctx, 910);
|
||||||
|
|
||||||
|
if ctx.get_primary_self_addr().await.ok().as_deref() != Some(¶m.addr) {
|
||||||
|
// Switched account, all server UIDs we know are invalid
|
||||||
|
job::schedule_resync(ctx).await?;
|
||||||
|
}
|
||||||
|
|
||||||
// the trailing underscore is correct
|
// the trailing underscore is correct
|
||||||
param.save_as_configured_params(ctx).await?;
|
param.save_as_configured_params(ctx).await?;
|
||||||
ctx.set_config(Config::ConfiguredTimestamp, Some(&time().to_string()))
|
ctx.set_config(Config::ConfiguredTimestamp, Some(&time().to_string()))
|
||||||
|
|||||||
Reference in New Issue
Block a user