fix: Correctly delete unneeded messages on the server; Remove "Delete Messages from Server" (delete_server_after) config option#8240
Merged
Conversation
iequidoo
reviewed
May 20, 2026
link2xt
reviewed
May 20, 2026
link2xt
reviewed
May 20, 2026
iequidoo
approved these changes
May 21, 2026
Collaborator
There was a problem hiding this comment.
Looks good, but not sure this should be merged right now because of the discussion at #8195 (comment)
link2xt
approved these changes
May 21, 2026
…ig option, second try
fc41f77 to
c013216
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 queryingpre_rfc724_midin addition torfc724_midfrom themsgstable. 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.test_one_account_send_bcc_setting()andtest_markseen_message_and_mdn()relies on the fact that messages stay on the server when bcc_self is on.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 thetransport_idand querying thetransportsSQL table.