edit_history: Support prev_subject not being present in database.

This commit serves as a checkpoint that can be deployed to production
before running the big Message format migration in the next commit.
This commit is contained in:
Tim Abbott
2022-03-01 17:09:41 -08:00
parent a410eee2e1
commit 5e819cdebc
4 changed files with 16 additions and 2 deletions

View File

@@ -51,8 +51,11 @@ def fill_edit_history_entries(
"user_id": edit_history_event["user_id"],
}
# Add current topic, map LEGACY_PREV_TOPIC => "prev_topic".
if LEGACY_PREV_TOPIC in edit_history_event:
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