url_preview: Fix 'Edited' notification for url preview events.

Uses the `rendering_only` field in the `update_message` event
to filter the addition of `last_edit_timestamp` to the message,
which is what triggers the addition of an `Edited` notification
when a message is rerendered in the web app.

Also, removes the deletion of `msg.last_edit_timestr` since this is
regenerated every time the message is rendered, and so it did nothing
beyond confusing the code.
This commit is contained in:
Lauryn Menard
2022-02-17 16:41:00 +01:00
committed by Tim Abbott
parent cbac466658
commit c9c980d7b0

View File

@@ -245,7 +245,6 @@ export function update_messages(events) {
msg.edit_history = [edit_history_entry].concat(msg.edit_history);
}
msg.last_edit_timestamp = event.edit_timestamp;
delete msg.last_edit_timestr;
// Remove the recent topics entry for the old topics;
// must be called before we call set_message_topic.
@@ -415,8 +414,13 @@ export function update_messages(events) {
msg.raw_content = event.content;
}
msg.last_edit_timestamp = event.edit_timestamp;
delete msg.last_edit_timestr;
// Mark the message as edited for the UI. The rendering_only
// flag is used to indicated update_message events that are
// triggered by server latency optimizations, not user
// interactions; these should not generate edit history updates.
if (!event.rendering_only) {
msg.last_edit_timestamp = event.edit_timestamp;
}
notifications.received_messages([msg]);
alert_words.process_message(msg);