edit_history: Use modern edit history format in frontend.

This commit is contained in:
Tim Abbott
2022-03-01 17:46:27 -08:00
parent 072051f81e
commit e54dfda0b1
5 changed files with 3 additions and 14 deletions

View File

@@ -107,7 +107,7 @@ test("msg_moved_var", () => {
}), }),
// topic changed: Move // topic changed: Move
build_message_context({ 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 // content edited: Edit
build_message_context({ build_message_context({

View File

@@ -136,10 +136,6 @@ run_test("get_edit_event_orig_topic", () => {
assert.equal(util.get_edit_event_orig_topic({orig_subject: "lunch"}), "lunch"); 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", () => { run_test("is_mobile", () => {
window.navigator = {userAgent: "Android"}; window.navigator = {userAgent: "Android"};
assert.ok(util.is_mobile()); assert.ok(util.is_mobile());

View File

@@ -66,10 +66,7 @@ function message_was_only_moved(message) {
if (edit_history_event.prev_content) { if (edit_history_event.prev_content) {
return false; return false;
} }
if ( if (edit_history_event.prev_topic || edit_history_event.prev_stream) {
util.get_edit_event_prev_topic(edit_history_event) ||
edit_history_event.prev_stream
) {
moved = true; moved = true;
} }
} }

View File

@@ -481,7 +481,7 @@ export function toggle_actions_popover(element, id) {
(entry) => (entry) =>
entry.prev_content !== undefined || entry.prev_content !== undefined ||
entry.prev_stream !== undefined || entry.prev_stream !== undefined ||
util.get_edit_event_prev_topic(entry) !== undefined, entry.prev_topic !== undefined,
) && ) &&
page_params.realm_allow_edit_history && page_params.realm_allow_edit_history &&
not_spectator; not_spectator;

View File

@@ -241,10 +241,6 @@ export function get_edit_event_orig_topic(obj) {
return obj.orig_subject; return obj.orig_subject;
} }
export function get_edit_event_prev_topic(obj) {
return obj.prev_subject;
}
export function is_topic_synonym(operator) { export function is_topic_synonym(operator) {
return operator === "subject"; return operator === "subject";
} }