Repository navigation
Conversation
c12a444 to
decc55d
Compare
|
This PR still has one problem, which is that even with If a post-message is received via multiple relays, and then it's downloaded later, it will only be deleted on the relay it was downloaded from. This can maybe be fixed by marking all messages as to-be-deleted. And whether this PR is the best approach is up for discussion, but I can't think of any other good solutions. |
decc55d to
6ab70a8
Compare
|
Marking for deletion on download sounds good to me. There is btw an edge category next to encrypted/unencrypted messages: "undecipherable". We probably don't want to delete them. "This can maybe be fixed by marking all messages as to-be-deleted": marking by Message-ID when a message is downloaded should delete it on all relays. |
f6dfbb0 to
6460e43
Compare
d8d56a1 to
ef080a6
Compare
93f0f5b to
643fe4a
Compare
…rce_encryption` was off This PR fixes an issue with the unencrypted-removal, where Delta Chat would suddenly delete unencrypted emails on old shared accounts. Therefore, this PR must be stack-merged together with the unencrypted-removal. Without this PR, the following problem could occur: - `bcc_self=0` and `force_encryption=0` - Delta Chat downloads some unencrypted messages - Then, the user upgrades to a version of Delta Chat that doesn't support unencrypted, or enables `force_encryption` again - Then, the MARK_DOWNLOADED_FOR_DELETION statement would suddenly mark all the previously-downloaded unencrypted messages for deletion In the future, Delta Chat won't even look at unencrypted messages anymore, so this won't be a problem anymore, but it _will_ be a problem while upgrading, and I don't want to accidentally delete someone's emails. So, after consulting with link2xt, this PR marks messages for deletion when downloading them rather than in every iteration of the `imap` loop. I anyways find this new logic easier to reason about. I first wanted to make this PR against `main`, but it was too hard to make the logic work well with `force_encryption=0`.
… a single SQL statement
643fe4a to
97741a4
Compare
| /// Returns whether a newly seen message is a copy of an already downloaded message, | ||
| /// e.g. a copy that arrived on another transport. | ||
| /// | ||
| /// Unencrypted copies are excluded, so that an old unencrypted email that appears with a new | ||
| /// UID (e.g. because the user moved it with a classical MUA) is not deleted. | ||
| async fn is_encrypted_copy_of_downloaded_msg( |
There was a problem hiding this comment.
Note that this returns true for tombstones of undecryptable or unsigned messages. So, if an undecryptable message arrives a second time some reason (maybe because the user moved it out of INBOX and then back into INBOX) then the second copy will be deleted.
This was the case before this PR already. It's a super rare edgecase of an edgecase, and fixing it would require to persist some extra info in the database, but I thought I'd point it out regardless as a trade-off.
2bb28ae to
e8e34e3
Compare
| // trigger a re-check by interrupting the inbox folder. | ||
| // This is mainly needed to make the tests pass; | ||
| // on real devices, it would be fine to delete the message at the next iteration. | ||
| context.scheduler.interrupt_inbox().await; |
There was a problem hiding this comment.
This call was moved into mark_msg_for_deletion()
|
|
||
| /// Sends a message with an attachment larger than [`PRE_MSG_ATTACHMENT_SIZE_THRESHOLD`] | ||
| /// and returns the sent pre- and post-message. | ||
| pub(crate) async fn send_large_file_message<'a>( |
There was a problem hiding this comment.
I moved this function here from pre_messages/util.rs
This PR is WIP, but the PR description is "ready" already. Also see the comments below.
This PR fixes an issue with the unencrypted-removal,
where Delta Chat would suddenly delete unencrypted emails on old shared accounts.
Therefore, this PR must be stack-merged together with the
unencrypted-removal.
Without this PR, the following problem could occur:
bcc_self=0andforce_encryption=0support unencrypted, or enables
force_encryptionpreviously-downloaded unencrypted messages for deletion
In the future, Delta Chat won't even look at unencrypted messages
anymore, so this won't be a problem anymore, but it will be a problem
while upgrading, and I don't want to accidentally delete someone's
emails.
So, after consulting with link2xt, this PR marks messages for deletion
when downloading them rather than in every iteration of the
imaploop.I anyways find this new logic easier to reason about.
I first wanted to make this PR against
main, but it was too hard tomake the logic work well with
force_encryption=0.test_is_encrypted_copy_of_downloaded_msg()is kind of testing the implementation, not sure if we should just remove it.TODO:
test_downloaded_post_msg_deleted_on_all_transportsdoesn't fail without the fix in d488741. I'll make a separate PR against main: fix: Download post-messages only from one transport #8939