feat: Remove "Delete Messages from Server" (delete_server_after) config option#8217
feat: Remove "Delete Messages from Server" (delete_server_after) config option#8217
Conversation
eb837a7 to
8e3e939
Compare
8e3e939 to
6ad3f80
Compare
… code, add some comments
…een(), test_mdn_asymmetric()
…re it tests was removed
52fe48d to
c70be03
Compare
| assert msg_in.text == msg_out.text | ||
|
|
||
|
|
||
| def test_verified_group_vs_delete_server_after(acfactory, tmp_path, lp): |
There was a problem hiding this comment.
This test tested how delete_server_after interacted with verified groups. We removed both features.
|
Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
Co-authored-by: iequidoo <117991069+iequidoo@users.noreply.github.com>
| context | ||
| .sql | ||
| .execute( | ||
| "UPDATE imap SET target='' WHERE rfc724_mid=?", |
There was a problem hiding this comment.
Should this filter by transport_id? Otherwise we are deleting the message from other transports as well just because the copy arrived to chatmail relay.
There was a problem hiding this comment.
Indeed, but filtering by transport_id also doesn't look correct because then the message isn't deleted from chatmail relays if it's received via a non-chatmail relay first because of the logic in prefetch_should_download(). I think that && is_chatmail should be removed from the expr above and SQL UPDATE should be done for all chatmail relays, not just for the current transport.
There was a problem hiding this comment.
Hm, if the message arrives later on the other relay, then we also want to remove it on that second relay. This needs some new logic, because currently the message there is ignored bc we already know it
|
OK, so, I now came up with a new logic for deletion: We have a function: async fn maybe_mark_for_deletion(
is_chatmail: bool,
rfc724_mid: &String,
context: &Context,
) -> Result<()> {
if !context.get_config_bool(Config::BccSelf).await? && is_chatmail {
context
.sql
.execute(
"UPDATE imap SET target='' WHERE rfc724_mid=?",
(rfc724_mid,),
)
.await?;
context.scheduler.interrupt_inbox().await;
}
Ok(())
}After prefetching, we want to call maybe_mark_for_deletion() iff it's not a post-message OR the post-message was already downloaded. After receive_imf(), we want to call maybe_mark_for_deletion() unconditionally. I.e. if it's a post-message that is Available, Failure, or InProgress, then we do not want to delete it. So, probably we should not filter by transport_id. I'm not sure about checking is_chatmail - maybe it's fine to just remove a message from all transports I.e., we want to delete everything for which prefetch_should_download() returns false, EXCEPT for the case where a post-message's download failed or is in progress. Right now, much of this is instead done by |
Fix #8195
The most interesting change is in
imap.rsbecause there, messages are marked for immediate deletion on single-device chatmail profiles.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 fetch_many_msgs()whether the server is Nauta, probably by querying thetransportsSQL table