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.

edit_history: Use modern edit history format in frontend.

Tim Abbotte54dfda0b164
diff --git a/frontend_tests/node_tests/message_list_view.js b/frontend_tests/node_tests/message_list_view.js
index 0458c2d16ce..9ad13262b90 100644
--- a/frontend_tests/node_tests/message_list_view.js
+++ b/frontend_tests/node_tests/message_list_view.js
@@ -107,7 +107,7 @@ test("msg_moved_var", () => {
}),
// topic changed: Move
build_message_context({
- edit_history: [{prev_subject: "test_topic", timestamp: 1000, user_id: 1}],
+ edit_history: [{prev_topic: "test_topic", timestamp: 1000, user_id: 1}],
}),
// content edited: Edit
build_message_context({
diff --git a/frontend_tests/node_tests/util.js b/frontend_tests/node_tests/util.js
index 35321e9ad90..aaa5204f2d5 100644
--- a/frontend_tests/node_tests/util.js
+++ b/frontend_tests/node_tests/util.js
@@ -136,10 +136,6 @@ run_test("get_edit_event_orig_topic", () => {
assert.equal(util.get_edit_event_orig_topic({orig_subject: "lunch"}), "lunch");
});
-run_test("get_edit_event_prev_topic", () => {
- assert.equal(util.get_edit_event_prev_topic({prev_subject: "dinner"}), "dinner");
-});
-
run_test("is_mobile", () => {
window.navigator = {userAgent: "Android"};
assert.ok(util.is_mobile());
diff --git a/static/js/message_list_view.js b/static/js/message_list_view.js
index 238ed679e72..2a116795ba4 100644
--- a/static/js/message_list_view.js
+++ b/static/js/message_list_view.js
@@ -66,10 +66,7 @@ function message_was_only_moved(message) {
if (edit_history_event.prev_content) {
return false;
}
- if (
- util.get_edit_event_prev_topic(edit_history_event) ||
- edit_history_event.prev_stream
- ) {
+ if (edit_history_event.prev_topic || edit_history_event.prev_stream) {
moved = true;
}
}
diff --git a/static/js/popovers.js b/static/js/popovers.js
index abace1b9847..53befac646c 100644
--- a/static/js/popovers.js
+++ b/static/js/popovers.js
@@ -481,7 +481,7 @@ export function toggle_actions_popover(element, id) {
(entry) =>
entry.prev_content !== undefined ||
entry.prev_stream !== undefined ||
- util.get_edit_event_prev_topic(entry) !== undefined,
+ entry.prev_topic !== undefined,
) &&
page_params.realm_allow_edit_history &&
not_spectator;
diff --git a/static/js/util.js b/static/js/util.js
index da494a2ec63..547a643c5fe 100644
--- a/static/js/util.js
+++ b/static/js/util.js
@@ -241,10 +241,6 @@ export function get_edit_event_orig_topic(obj) {
return obj.orig_subject;
}
-export function get_edit_event_prev_topic(obj) {
- return obj.prev_subject;
-}
-
export function is_topic_synonym(operator) {
return operator === "subject";
}