edit_history: Remove prev_subject from EditHistoryEvent type.

It is no longer possible for this field to appear in actual entries.
This commit is contained in:
Tim Abbott 2022-03-01 17:23:18 -08:00
parent 7e298365dc
commit 4e91d03d56
3 changed files with 2 additions and 9 deletions

View File

@ -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(

View File

@ -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

View File

@ -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: