feat: Enable OnlyFetchMvbox by default (#7190)

This is a replacement for 2260156c40 "feat: Don't fetch messages from
unknown folders", but limited to the case with `MvboxMove` enabled. It's enabled by default, so most
users still gain from not fetching messages from unknown folders.
This commit is contained in:
iequidoo
2025-09-30 14:45:13 -03:00
parent 1cf067c045
commit 8c95336c89
3 changed files with 17 additions and 2 deletions

View File

@@ -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.

View File

@@ -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 {

View File

@@ -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?