mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 14:03:30 +00:00
message view: Fix the wrong time shown for message locally echoed.
This commit updates the _rerender_message to update the message_time string with the current timestamp on the message rerender. When we locally echo a message, we store a local timestamp that will generally not be used as it is replaced by the server time in echo.process_from_server when we confirm receipt of the message. echo.process_from_server correctly updates the .timestamp field on the message and triggers a rerender but that rerender reuses the message_container object without recomputing the message_container.timestr due to which wrong older timestr was shown on the message box. This commit fix this by calling set_timestr in the rerender code path, alongside calls to update similar data structures like this._maybe_format_me_message. Fixes #17655
This commit is contained in:
@@ -1135,6 +1135,13 @@ export class MessageListView {
|
||||
this._maybe_format_me_message(message_container);
|
||||
this._add_msg_edited_vars(message_container);
|
||||
|
||||
// The timestr of message_container can be outdated if locally
|
||||
// echoed. When the server sends the new timestamp, though the
|
||||
// timestamp gets updated in echo.js, the timestr does not.
|
||||
// This updates the timestr which will be then be used to
|
||||
// update the message_time during rerender.
|
||||
set_timestr(message_container);
|
||||
|
||||
// Make sure the right thing happens if the message was edited to mention us.
|
||||
message_container.contains_mention = message_container.msg.mentioned;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user