edemaine / coauthor

Coauthor supercollaboration/discussion forum
MIT License
246 stars 32 forks source link

Destroy empty messages #541

Open edemaine opened 3 years ago

edemaine commented 3 years ago

Another way to "avoid" blank messages that we discussed in the dev meeting today:

If a message ends up with no editors and has had no edits (except possibly a delete action), then it automatically gets superdeleted.

So in particular if a user makes a reply and either forgets about it (so will auto-stop-editing in 1 hour) or clicks Stop Editing or clicks Action / Delete, then the message disappears for everyone.

We can also change the name of the Stop Editing button in this situation, to something like "Cancel Message". (A similar idea)

One implementation approach: Messages have an "edited" flag set to true every step. Actually, I think we can just check that the created timestamp equals the updated timestamp when messageEditStop gets called, or when messageEdit gets called with a delete operation. Except if there's a file attached!

Alternative approaches wait until the message is nonempty, which prevents immediate collaboration / indication that someone has started a message (though only by a bit).:

  1. Display a local editor, and don't actually create a message on the server until some text gets typed (similar to #153). The disadvantage of this is that it's trickier to implement: need to transition from local to synchronized editor — though it should be possible).
  2. Message is unpublished until you start typing (#25). A disadvantage of this is that the creator still has the message visible forever.