api: Add additional fields to edit_history entries.

Since we've changed the database to contain these new fields, we just
need to stop dropping them in the API code.

This also changes the public API to match the database format again
by removing `prev_subject` from edit history API.

Adds an API changelog feature update for the renamed `prev_subject`
field (to `prev_topic`) and new fields (`topic` and `stream`)
in the message `edit_history`.

Also, documents said `edit_history` in the `MessagesBase` schema
in the api documentation, which is used by the `/get-messages`,
`/get-events` and `/zulip-outgoing-webhooks` endpoints.

Fixes #21076.

Co-authored-by: Lauryn Menard <lauryn.menard@gmail.com>
This commit is contained in:
Lauryn Menard
2022-02-14 17:04:39 +01:00
committed by Tim Abbott
parent 4e91d03d56
commit 072051f81e
7 changed files with 173 additions and 76 deletions

View File

@@ -91,32 +91,11 @@ class UnspecifiedValue:
pass
class APIEditHistoryEvent(TypedDict, total=False):
"""Format of legacy edit history events in the API. Contains legacy
fields like LEGACY_PREV_TOPIC that we intend to remove from the
API eventually.
"""
# Commented fields are fields we plan to add.
user_id: Optional[int]
timestamp: int
prev_stream: int
# stream: int
# TODO: Remove prev_subject from the API.
prev_subject: str
# prev_topic: str
# topic: str
prev_content: str
prev_rendered_content: Optional[str]
prev_rendered_content_version: Optional[int]
class EditHistoryEvent(TypedDict, total=False):
"""
Database format for edit history events.
"""
# Commented fields are fields we plan to add.
user_id: Optional[int]
timestamp: int
prev_stream: int