"Clear chat" function

We need a “Clear chat” button in the chat actions menu. Now there is only “Delete chat” which will exclude the whole conversation from the chats list, but not delete the messages from a server.

I propose the “Clear chat” button which will delete all the messages of the current chat locally and remotely (on server), leaving the chat window empty, without deleting the chat from the chat list.

Telegram has this function with a button “Clear history” and it is very useful to clean some space, specially in group chats used for frequent notifications or something else.

1 Like


as deleting a single message defaults to “also delete the message from the server”, and because doing this makes sense to keep multiple clients in sync, I actually believe it is a bug that deleting the whole chat leaves messages behind on the server: https://github.com/deltachat/deltachat-core/issues/210

But note that there are cases when messages should not be deleted from the server, for example “starred” messages, or “archived” messages that should be kept locally.

We currently identified four message states which should allow deltachat to manage the requirements for operating, syncing, starring, auto-deleting, and archiving properly. Maybe have a look and see if you find something that may be missing https://github.com/deltachat/deltachat-core/issues/164#issuecomment-417868402

Well, as the “Delete chat” button notifies a user that “its messages will remain on the server” it’s not a bug, but a part of the current functionality. Or do you mean it’s an architectural bug? If so, I understand your point and nearly agree with you, because I wouldn’t require leaving messages on server if i consciously decided to delete the chat.
Maybe leaving messages for backup purposes may serve well for indecisive users. I would simply prefer having an option on “Delete chat” behaviour - whether to delete messages remotely or to leave them. This option would be good appearing in a form of 2 confirmation buttons, ie:


  • “Delete locally” does the same as clicking “OK” in the current variant.
  • “Delete globally” additionally invokes clear_chat() that I propose in this topic, as my proposal is to delete messages from the server while clearing the chat’s history.

As for message states, I don’t think anything is missing for now.

Talking about subject, there is still a requirement to manually clear a chat window without deleting it from the roster. I would like to clear a chat for privacy reasons when I need, but continue messaging on it right after it’s clean without having to make unnecessary moves for adding the chat back to my chat list.
Technically, it may clean the “synced” state messages only, deleting them from the device and from the server.

Yes, there needs to be a way to clear all messages from a chat, I just wouldn’t create a separate chat oriented “clear chat” for this (besides the “delete chat” from the chat list), but instead integrate a more versatile manual bulk-deletion functionality for messages (from within a chat), for example a “select/delete all messages up to this one” (except archived/starred) https://github.com/deltachat/deltachat-core/issues/120

I actually didn’t remember that deleting a chat produces a pop-up that says the messages stay on the server. As this message is in contradiction to the usual message deletion confirmation pop-up, it is also very likely that this detail gets overlooked by the user, maybe I overlooked it.

Yes, I do believe that this contradicting behaviour is a UI/UX bug, and also came to the conclusion that the idea of pop-ups that always ask the user what to do is suboptimal for repetitive tasks, especially if the problem can be better solved with adequate context rules. Before, I had actually proposed a similar confirmation dialog as you did https://github.com/deltachat/deltachat-android/issues/321, but I think the planned message states do also allow us to have more specific, and actually very sensible, default deletion behaviors for the different message states.

The “results table” of the conditions proposed in https://github.com/deltachat/deltachat-core/issues/120 may look like this:

Message State By default, entering this state… By default, deletion takes effect…
synced (and synced-new if deleted manually) on device and server
starred never
archived deletes from server on device

Archived messages would therefore default to be local backups of older messages that were not deleted during their “sync time”, and are then protected from accidental deletes. If one also wants a protected archive for all the new messages, the option “archiving deletes from server” may be disabled on one client, and the “number of synced messages” may be set to zero for this client.

As you mentioned the idea of leaving messages on the server for backup purposes (if there is enough space), this may be accomplished by disabling the default “archiving deletes from server” on all clients.

The reason why I think “archiving deletes from server” is preferable as the default is, because if old messages would stay on the server by default, auto-deletes would likely have to eventually delete “archived” messages on smaller servers, to ensure further operation (message reception), which may not be expected and undesired. A full disk at the local device, on the other hand, is much less critical, and there is no problem with asking the user to create some space, possibly by manually deleting some archived messages.

When archiving tidies up the server, the INBOX is also more likely to have enough buffering space for incoming messages without having to delete any of regular “synced” messages.

EDIT: Actually I think, the server space limiting auto-delete should do an auto-archive of the message, before force-deleting from the server, in order to try not to loose any messages.

Vlanmx, is that right, there are IP cams sending event emails over a MX server in your vlan and you get notified about that in deltachat?

I have not checked Autocrypt so this may be wrong:
Since the app have a focus on privacy I think people in critical situations will want a “Panic Button” to delete all their chats (and private keys) so their messages are unrecoverable.

Saw f-droid has something like that in its options, don’t know if it can also delete the data when uninstalling apps is triggered.

Yes, our company have migrated all billing/outage notification systems from Telegram to Delta Chat in order to improve corporate secrecy, thus our cameras send intrusion detection alerts to a delta group chat.

Ok, that makes your use-case much more understandable to me.

With the current design of the message states, I only see the possibility to customize the auto-archive, and disable the displaying of archived messages in this “alert” chat, to reduce the number of shown messages. But this would not allow to always show all, and only those messages that are relevant at any given time (e.g. if there are many, or some earlier ones get irrelevant).

I still think a separtate “clear chat” message may be avoided and not necessary if there is support for better bulk deletions within a chat (e.g. “all messages up to this one”), but what could be the best options to allow “always showing only a specific set of messages”?

PS: In your screenshots the messages don’t seem to be encrypted, maybe one of the scriptable tools listed at https://autocrypt.org can help improve this.