-
-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Contact deletion may delete a contact with existing messages #4792
Comments
I'm unsure we should never delete garbage from the db. Better to change all places in the code so that they expect that a contact could be already deleted. F.e. for messages referencing a deleted account DC could show "Deleted-<contact_id>" as a contact name so that a user can see which messages are from the same contact, and so on. Do we really need some contact info to be preserved after that contact deletion? If so, maybe it's better to store it in other tables where it's actually needed, instead of contact ID? |
that sounds like a big refactoring, including new and other issues. (housekeeping as such was introduced to avoid re-downloading of just deleted or not shown message - and then, as it is there, used for other things) wondering what the goal of the physical contact deletion is - eg. the deletion of an entry in "new chat suggestion" (or the "address list" if you will) does not imply ux-wise that all older messages are deleted or their contact data are anonymized. this was never the idea. so, maybe there is just no reasonable actionale item :) |
I believe, for the deleting problem the proposed solution from @link2xt is pretty good as there are very few things that can break with this approach (even though we need to think about how to handle the verifier information as users may still want to see the formerly deleted email in verifier information). |
If we do nothing, there is a real bug remaining:
I would expect either contact A getting only hidden in this case, or become an anonymous/ghost/tombstone contact, like what happens when a user deletes their account on GitHub or gets anonymized in Discourse forum. |
Maybe there should be a separate core API, like |
I think we should only have two functions: |
I'd prefer to see "Deleted-<from_id>" (in grayish) as the name and some hash image like GitHub's identicon as the avatar.
I'm not sure that deleting a contact should delete the 1:1 chat. At least at the core level these can be separate entities. And as for removing the contact from groups, is it possible at all? What if new message arrives, of course containing the contact address in "To"? Why do we want to remove all associated messages? Anyway messages can be quoted |
UIs already use |
Then it's indeed better to delete the contact completely from the db to avoid db bloat for bots. And just to fix all places in the code that misbehave if contact_id refers to an unexistent contact. Even if this takes some time, it's the problem for bots, not for all users. |
In the UI, I would only show the The other API |
Here SQL code checks that the contact is not a member of any chat:
deltachat-core-rust/src/contact.rs
Lines 1062 to 1066 in a119b24
However, even if the contact is not a member of the chat, they may be a former member of the chat and have messages there. In this case these messages will start pointing to non-existent contact. The contact ID may still be used in
msgs.from_id
,msgs.to_id
,locations.from_id
,msgs_mdns.contact_id
. Address may still be inacpeerstates.addr
andacpeerstates.verifier
.See previous comment here: #4791 (review)
Maintaining the code checking that contact is not referenced from anywhere is error-prone. Trying to delete the contact in housekeeping as proposed in #4775 may never actually delete the contact if they sent us a message in another chat, tried to add us to the group, sent us a location etc.
As an alternative solution, maybe we should actually never delete an account, but anonymize it instead, similarly to how Discourse and GitHub do this when user deletes an account? As long as we are not going to write to this contact, we can replace its address, name, authname and hide it.
The text was updated successfully, but these errors were encountered: