diff --git a/src/config.rs b/src/config.rs index c26e130b3..fa917c7c7 100644 --- a/src/config.rs +++ b/src/config.rs @@ -169,7 +169,7 @@ pub enum Config { /// /// This will not entirely disable other folders, e.g. the spam folder will also still /// be scanned for new messages. - #[strum(props(default = "0"))] + #[strum(props(default = "1"))] OnlyFetchMvbox, /// Whether to show classic emails or only chat messages. diff --git a/src/imap/imap_tests.rs b/src/imap/imap_tests.rs index 1aa746ea9..34c7bb9df 100644 --- a/src/imap/imap_tests.rs +++ b/src/imap/imap_tests.rs @@ -122,8 +122,9 @@ async fn check_target_folder_combination( t.ctx .set_config(Config::ConfiguredSentboxFolder, Some("Sent")) .await?; + t.ctx.set_config_bool(Config::MvboxMove, mvbox_move).await?; t.ctx - .set_config(Config::MvboxMove, Some(if mvbox_move { "1" } else { "0" })) + .set_config_bool(Config::OnlyFetchMvbox, mvbox_move) .await?; if accepted_chat { diff --git a/src/sql/migrations.rs b/src/sql/migrations.rs index 116a2a0ef..7a6bf775d 100644 --- a/src/sql/migrations.rs +++ b/src/sql/migrations.rs @@ -1342,6 +1342,20 @@ CREATE INDEX gossip_timestamp_index ON gossip_timestamp (chat_id, fingerprint); .await?; } + inc_and_check(&mut migration_version, 139)?; + if dbversion < migration_version { + // `OnlyFetchMvbox` is now 1 by default to avoid scanning unknown folders. But if the user + // disabled `MvboxMove`, we have to keep `OnlyFetchMvbox` unset so that Inbox is watched. + sql.execute_migration( + "INSERT OR IGNORE INTO config (keyname, value) + SELECT 'only_fetch_mvbox', '0' + FROM config WHERE keyname='mvbox_move' AND value='0' + ", + migration_version, + ) + .await?; + } + let new_version = sql .get_raw_config_int(VERSION_CFG) .await?