-
-
Notifications
You must be signed in to change notification settings - Fork 116
fix: reset options not available for chatmail on chatmail profiles #7649
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR adds a database migration (version 144) to automatically reset three configuration options for chatmail profiles that should not be available or set for these accounts. The migration addresses user reports where incorrect settings prevented them from adding relays or caused issues with the expiry script on chatmail servers.
- Deletes
only_fetch_mvboxandshow_emailsconfig keys for chatmail accounts - Resets
mvbox_moveto '0' (disabled) for chatmail accounts - Only applies changes if the account is identified as a chatmail profile
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| inc_and_check(&mut migration_version, 144)?; | ||
| if dbversion < migration_version { | ||
| sql.execute_migration_transaction( | ||
| |transaction| { | ||
| let is_chatmail = transaction | ||
| .query_row( | ||
| "SELECT value FROM config WHERE keyname='is_chatmail'", | ||
| (), | ||
| |row| { | ||
| let value: String = row.get(0)?; | ||
| Ok(value) | ||
| }, | ||
| ) | ||
| .optional()? | ||
| .as_deref() | ||
| == Some("1"); | ||
|
|
||
| if is_chatmail { | ||
| transaction.execute_batch( | ||
| "DELETE FROM config WHERE keyname='only_fetch_mvbox'; | ||
| DELETE FROM config WHERE keyname='show_emails'; | ||
| UPDATE config SET value='0' WHERE keyname='mvbox_move'", | ||
| )?; | ||
| } | ||
| Ok(()) | ||
| }, | ||
| migration_version, | ||
| ) | ||
| .await?; | ||
| } |
Copilot
AI
Dec 24, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This migration resets chatmail profile options that should not be set, but there is no test coverage for this migration. Consider adding a test case similar to the existing migration tests that:
- Sets up a chatmail profile with these config values set incorrectly
- Runs the migration
- Verifies that
only_fetch_mvboxandshow_emailsare deleted andmvbox_moveis set to '0'
This would help ensure the migration works correctly and prevent regressions.
Closes #7622
Closes #7623
Replacement for #7624