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: Remove prev_subject from EditHistoryEvent type.

Tim Abbott4e91d03d562d
diff --git a/zerver/lib/message.py b/zerver/lib/message.py
index bdc2b654611..f13b19fd49b 100644
--- a/zerver/lib/message.py
+++ b/zerver/lib/message.py
@@ -514,7 +514,7 @@ class MessageDict:
if "prev_topic" in edit_history_event:
# The prev_subject field has been renamed in the
# database, but not the API.
- edit_history_event["prev_subject"] = edit_history_event["prev_topic"]
+ edit_history_event["prev_subject"] = edit_history_event["prev_topic"] # type: ignore # Temporary type-checking violation
# New fields not consistently available, and thus
# intentionally not exposed to the API.
@@ -525,7 +525,7 @@ class MessageDict:
if "topic" in edit_history_event:
del edit_history_event["topic"]
- edit_history.append(edit_history_event)
+ edit_history.append(edit_history_event) # type: ignore # Temporary type-checking violation
obj["edit_history"] = edit_history
if Message.need_to_render_content(
diff --git a/zerver/lib/types.py b/zerver/lib/types.py
index c7ab897e4bb..53fd941e7b2 100644
--- a/zerver/lib/types.py
+++ b/zerver/lib/types.py
@@ -121,9 +121,6 @@ class EditHistoryEvent(TypedDict, total=False):
timestamp: int
prev_stream: int
stream: int
- # One of prev_subject and prev_topic is guaranteed to exist; if
- # both exist they will have identical values.
- prev_subject: str
prev_topic: str
topic: str
prev_content: str
diff --git a/zerver/views/message_edit.py b/zerver/views/message_edit.py
index 68ef39efcc7..caa383675c5 100644
--- a/zerver/views/message_edit.py
+++ b/zerver/views/message_edit.py
@@ -54,10 +54,6 @@ def fill_edit_history_entries(
if "prev_topic" in edit_history_event:
prev_topic = edit_history_event["prev_topic"]
formatted_entry["prev_topic"] = prev_topic
- elif LEGACY_PREV_TOPIC in edit_history_event:
- # TODO: Delete this once we've finished migrating legacy message objects.
- prev_topic = edit_history_event["prev_subject"]
- formatted_entry["prev_topic"] = prev_topic
# Fill current values for content/rendered_content.
if "prev_content" in edit_history_event: