mirror of
https://github.com/zulip/zulip.git
synced 2025-11-01 20:44:04 +00:00
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:
committed by
Tim Abbott
parent
f0fd812cc5
commit
1682d75ea8
@@ -195,8 +195,14 @@ MessageListView.prototype = {
|
||||
_RENDER_THRESHOLD: 50,
|
||||
|
||||
_get_msg_timestring: function (message_container) {
|
||||
if (message_container.msg.last_edit_timestamp !== undefined) {
|
||||
const last_edit_time = new XDate(message_container.msg.last_edit_timestamp * 1000);
|
||||
let last_edit_timestamp;
|
||||
if (message_container.msg.local_edit_timestamp !== undefined) {
|
||||
last_edit_timestamp = message_container.msg.local_edit_timestamp;
|
||||
} else {
|
||||
last_edit_timestamp = message_container.msg.last_edit_timestamp;
|
||||
}
|
||||
if (last_edit_timestamp !== undefined) {
|
||||
const last_edit_time = new XDate(last_edit_timestamp * 1000);
|
||||
const today = new XDate();
|
||||
return timerender.render_date(last_edit_time, undefined, today)[0].textContent +
|
||||
" at " + timerender.stringify_time(last_edit_time);
|
||||
@@ -219,6 +225,11 @@ MessageListView.prototype = {
|
||||
message_container.edited_in_left_col = !include_sender;
|
||||
message_container.edited_alongside_sender = include_sender && !status_message;
|
||||
message_container.edited_status_msg = include_sender && status_message;
|
||||
} else {
|
||||
delete message_container.last_edit_timestr;
|
||||
message_container.edited_in_left_col = false;
|
||||
message_container.edited_alongside_sender = false;
|
||||
message_container.edited_status_msg = false;
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user