Skip to content

fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option#8240

Merged
link2xt merged 9 commits into
mainfrom
hoc/remove-delete_server_after-2
May 22, 2026
Merged

fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option#8240
link2xt merged 9 commits into
mainfrom
hoc/remove-delete_server_after-2

Conversation

@Hocuri
Copy link
Copy Markdown
Collaborator

@Hocuri Hocuri commented May 13, 2026

Supersedes #8217, fix #8195.

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.

Open question: Do we want to treat Nauta.cu like a chatmail server, in order to keep the old behavior on Nauta of auto-deleting? If not, I'll tell @adbenitez how he can do it in AC. In order to do this, need to find out in fn should_delete_all_downloaded_messages() whether the server is Nauta, probably by passing the transport_id and querying the transports SQL table.

@Hocuri Hocuri marked this pull request as draft May 13, 2026 20:04
@hpk42 hpk42 added the blocker label May 14, 2026
@Hocuri Hocuri changed the title feat: Remove "Delete Messages from Server" (delete_server_after) config option, second try fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option May 20, 2026
@Hocuri Hocuri marked this pull request as ready for review May 20, 2026 10:46
@Hocuri Hocuri requested review from iequidoo and link2xt May 20, 2026 10:47
Comment thread src/smtp.rs
Comment thread src/provider/data.rs
Comment thread src/ephemeral.rs Outdated
Comment thread src/ephemeral.rs Outdated
Comment thread src/message.rs Outdated
Comment thread deltachat-rpc-client/tests/test_something.py
Comment thread src/ephemeral/ephemeral_tests.rs Outdated
Comment thread src/ephemeral/ephemeral_tests.rs Outdated
Comment thread src/imap.rs
Comment thread src/ephemeral.rs Outdated
Comment thread src/smtp.rs
@Hocuri Hocuri requested review from iequidoo and link2xt May 21, 2026 07:30
Copy link
Copy Markdown
Collaborator

@iequidoo iequidoo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but not sure this should be merged right now because of the discussion at #8195 (comment)

@link2xt link2xt force-pushed the hoc/remove-delete_server_after-2 branch from fc41f77 to c013216 Compare May 22, 2026 05:13
@link2xt link2xt merged commit 961cacd into main May 22, 2026
31 checks passed
@link2xt link2xt deleted the hoc/remove-delete_server_after-2 branch May 22, 2026 16:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Remove delete_server_after config

4 participants