mirror of
https://github.com/chatmail/core.git
synced 2026-05-24 09:16:32 +03:00
fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option (#8240)
Fix https://github.com/chatmail/core/issues/8195 Supersedes https://github.com/chatmail/core/pull/8217 The most interesting change is in `delete_expired_imap_messages()` because there, messages are marked for deletion on single-device chatmail profiles. The logic in `delete_expired_imap_messages()` was wrong before, and pre-messages were not deleted at all. This is fixed by also querying `pre_rfc724_mid` in addition to `rfc724_mid` from the `msgs` table. In order not to make the SQL statement too complex, I split it into two. WRT tests: - `test_immediate_autodelete()` tests the auto-deletion; `test_imap_autodelete_fully_downloaded_msg()` tests that even for a message that is split into pre- and post-message, both messages are deleted. - A lot of tests test that if bcc_self is on, messages are not auto-deleted. E.g. `test_one_account_send_bcc_setting()` and `test_markseen_message_and_mdn()` relies on the fact that messages stay on the server when bcc_self is on. - Unfortunately, it is not possible to test that messages are only deleted for chatmail servers, because we don't have any tests that use a non-chatmail server.
This commit is contained in:
@@ -1236,11 +1236,9 @@ pub async fn cmdline(context: Context, line: &str, chat_id: &mut ChatId) -> Resu
|
||||
"estimatedeletion" => {
|
||||
ensure!(!arg1.is_empty(), "Argument <seconds> missing");
|
||||
let seconds = arg1.parse()?;
|
||||
let device_cnt = message::estimate_deletion_cnt(&context, false, seconds).await?;
|
||||
let server_cnt = message::estimate_deletion_cnt(&context, true, seconds).await?;
|
||||
println!(
|
||||
"estimated count of messages older than {seconds} seconds:\non device: {device_cnt}\non server: {server_cnt}"
|
||||
);
|
||||
let from_server = false;
|
||||
let device_cnt = message::estimate_deletion_cnt(&context, from_server, seconds).await?;
|
||||
println!("estimated count of messages older than {seconds} seconds: {device_cnt}");
|
||||
}
|
||||
"" => (),
|
||||
_ => bail!("Unknown command: \"{arg0}\" type ? for help."),
|
||||
|
||||
Reference in New Issue
Block a user