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:
||By default, entering this state…
||By default, deletion takes effect…
|synced (and synced-new if deleted manually)
||on device and server
||deletes from server
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.