message_edit: Add message edit local echo.

Updates the message editing process to do a local 'echo'.

On slow connections, now there is visual confirmation of the edit,
similar to when sending messages.  The contains_backend_only_syntax
logic and check are the same as there.

We showing "(SAVING)" until the edit is completed, and on successful
edit, the word "(EDITED)" appears.  There's likely useful future work
to do on making the animation experience nicer.

Substantially rewritten by tabbott to better handle corner cases and
communicate more clearly about what's happening.

Fixes: #3530.
This commit is contained in:
Jack Tiggleman
2019-04-22 14:13:23 -04:00
committed by Tim Abbott
parent f0fd812cc5
commit 1682d75ea8
7 changed files with 148 additions and 6 deletions

View File

@@ -190,6 +190,15 @@ messages.
primarily done in `exports.process_from_server` in
`static/js/echo.js`.
### Local echo in message editing
Zulip also supports local echo in the message editing code path for
edits to just the content of a message. The approach is analogous
(using `markdown.contains_backend_only_syntax`, etc.)), except we
don't need any of the `local_id` tracking logic, because the message
already has a permanent message id; as a result, the whole
implementation was under 150 lines of code.
## Putting it all together
This section just has a brief review of the sequence of steps all in