Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

message_edit: Fix display of repeated stream moves.

Tim Abbottb7a07a753f93
diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js
index be343433a11..da4f44c9995 100644
--- a/static/js/message_edit_history.js
+++ b/static/js/message_edit_history.js
@@ -24,6 +24,7 @@ export function fetch_and_render_message_history(message) {
success(data) {
const content_edit_history = [];
let prev_time = null;
+ let prev_stream_item = null;
for (const [index, msg] of data.message_history.entries()) {
// Format times and dates nicely for display
@@ -60,7 +61,12 @@ export function fetch_and_render_message_history(message) {
} else {
item.prev_stream = stream_data.maybe_get_stream_name(msg.prev_stream);
}
- item.new_stream = stream_data.maybe_get_stream_name(message.stream_id);
+ if (prev_stream_item !== null) {
+ prev_stream_item.new_stream = stream_data.maybe_get_stream_name(
+ msg.prev_stream,
+ );
+ }
+ prev_stream_item = item;
} else if (msg.prev_topic) {
item.posted_or_edited = $t({defaultMessage: "Topic edited by"});
item.topic_edited = true;
@@ -75,7 +81,12 @@ export function fetch_and_render_message_history(message) {
} else {
item.prev_stream = stream_data.maybe_get_stream_name(msg.prev_stream);
}
- item.new_stream = stream_data.maybe_get_stream_name(message.stream_id);
+ if (prev_stream_item !== null) {
+ prev_stream_item.new_stream = stream_data.maybe_get_stream_name(
+ msg.prev_stream,
+ );
+ }
+ prev_stream_item = item;
} else {
// just a content edit
item.posted_or_edited = $t({defaultMessage: "Edited by"});
@@ -83,9 +94,11 @@ export function fetch_and_render_message_history(message) {
}
content_edit_history.push(item);
-
prev_time = time;
}
+ if (prev_stream_item !== null) {
+ prev_stream_item.new_stream = stream_data.maybe_get_stream_name(message.stream_id);
+ }
$("#message-history").attr("data-message-id", message.id);
$("#message-history").html(
render_message_edit_history({