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-history: Show the edited stream in the edit history.

somesh2022b10f958bb25
diff --git a/static/js/message_edit_history.js b/static/js/message_edit_history.js
index b99516516d8..2e954c03d3d 100644
--- a/static/js/message_edit_history.js
+++ b/static/js/message_edit_history.js
@@ -12,6 +12,8 @@ import {page_params} from "./page_params";
import * as people from "./people";
import * as popovers from "./popovers";
import * as rows from "./rows";
+import * as stream_data from "./stream_data";
+import * as sub_store from "./sub_store";
import * as timerender from "./timerender";
import * as ui_report from "./ui_report";
@@ -46,11 +48,34 @@ export function fetch_and_render_message_history(message) {
item.topic_edited = true;
item.prev_topic = msg.prev_topic;
item.new_topic = msg.topic;
+ } else if (msg.prev_topic && msg.prev_stream) {
+ const sub = sub_store.get(msg.prev_stream);
+ item.posted_or_edited = "Edited by";
+ item.topic_edited = true;
+ item.prev_topic = msg.prev_topic;
+ item.new_topic = msg.topic;
+ item.stream_changed = true;
+ if (!sub) {
+ item.prev_stream = "Unknown Stream";
+ } 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);
} else if (msg.prev_topic) {
item.posted_or_edited = "Topic edited by";
item.topic_edited = true;
item.prev_topic = msg.prev_topic;
item.new_topic = msg.topic;
+ } else if (msg.prev_stream) {
+ const sub = sub_store.get(msg.prev_stream);
+ item.posted_or_edited = "Stream edited by";
+ item.stream_changed = true;
+ if (!sub) {
+ item.prev_stream = "Unknown Stream";
+ } 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);
} else {
// just a content edit
item.posted_or_edited = "Edited by";
diff --git a/static/templates/message_edit_history.hbs b/static/templates/message_edit_history.hbs
index bb979729d89..6405f5dd88c 100644
--- a/static/templates/message_edit_history.hbs
+++ b/static/templates/message_edit_history.hbs
@@ -9,6 +9,9 @@
{{#if topic_edited}}
<div class="message_content message_edit_history_content"><p>Topic: <span class="highlight_text_inserted">{{ new_topic }}</span> <span class="highlight_text_deleted">{{ prev_topic }}</span></p></div>
{{/if}}
+ {{#if stream_changed}}
+ <div class="message_content message_edit_history_content"><p>Stream: <span class="highlight_text_inserted">{{ new_stream }}</span> <span class="highlight_text_deleted">{{ prev_stream }}</span></p></div>
+ {{/if}}
{{#if body_to_render}}
<div class="message_content rendered_markdown message_edit_history_content">{{rendered_markdown body_to_render}}</div>
{{/if}}