mirror of
https://github.com/zulip/zulip.git
synced 2025-11-15 11:22:04 +00:00
edit_history: Remove 'prev_rendered_content_version' field.
This commit removes the 'prev_rendered_content_version'
field from:
* the 'edit_history' object within message objects in the
API response of `GET /messages`, `GET /messages/{message_id}`
and `POST /zulip-outgoing-webhook`.
* the 'update_message' event type
as it is an internal server implementation detail not used
by any client.
Note: The field is still stored in the 'edit_history' column
of the 'Message' table as it will be helpful when making
major changes to the markup rendering process.
This commit is contained in:
committed by
Tim Abbott
parent
c51bd1eab8
commit
656c65c74c
@@ -20,6 +20,15 @@ format used by the Zulip server that they are interacting with.
|
|||||||
|
|
||||||
## Changes in Zulip 10.0
|
## Changes in Zulip 10.0
|
||||||
|
|
||||||
|
**Feature level 284**
|
||||||
|
|
||||||
|
* [`GET /events`](/api/get-events), [`GET /messages`](/api/get-messages),
|
||||||
|
[`GET /messages/{message_id}`](/api/get-message),
|
||||||
|
[`POST /zulip-outgoing-webhook`](/api/zulip-outgoing-webhooks): Removed
|
||||||
|
the `prev_rendered_content_version` field from the `edit_history` object
|
||||||
|
within message objects and the `update_message` event type as it is an
|
||||||
|
internal server implementation detail not used by any client.
|
||||||
|
|
||||||
**Feature level 283**
|
**Feature level 283**
|
||||||
|
|
||||||
* [`GET /events`](/api/get-events), [`POST /register`](/api/register-queue),
|
* [`GET /events`](/api/get-events), [`POST /register`](/api/register-queue),
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ DESKTOP_WARNING_VERSION = "5.9.3"
|
|||||||
# entries in the endpoint's documentation in `zulip.yaml`.
|
# entries in the endpoint's documentation in `zulip.yaml`.
|
||||||
|
|
||||||
|
|
||||||
API_FEATURE_LEVEL = 283 # Last bumped for can_manage_group
|
API_FEATURE_LEVEL = 284 # Last bumped for removing 'prev_rendered_content_version'
|
||||||
|
|
||||||
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
# Bump the minor PROVISION_VERSION to indicate that folks should provision
|
||||||
# only when going from an old version of the code to a newer version. Bump
|
# only when going from an old version of the code to a newer version. Bump
|
||||||
|
|||||||
@@ -155,7 +155,6 @@ export function update_messages(events) {
|
|||||||
user_id: event.user_id,
|
user_id: event.user_id,
|
||||||
prev_content: event.orig_content,
|
prev_content: event.orig_content,
|
||||||
prev_rendered_content: event.orig_rendered_content,
|
prev_rendered_content: event.orig_rendered_content,
|
||||||
prev_rendered_content_version: event.prev_rendered_content_version,
|
|
||||||
timestamp: event.edit_timestamp,
|
timestamp: event.edit_timestamp,
|
||||||
};
|
};
|
||||||
// Add message's edit_history in message dict
|
// Add message's edit_history in message dict
|
||||||
|
|||||||
@@ -37,7 +37,6 @@ const message_edit_history_entry_schema = z.object({
|
|||||||
timestamp: z.number(),
|
timestamp: z.number(),
|
||||||
prev_content: z.optional(z.string()),
|
prev_content: z.optional(z.string()),
|
||||||
prev_rendered_content: z.optional(z.string()),
|
prev_rendered_content: z.optional(z.string()),
|
||||||
prev_rendered_content_version: z.optional(z.number()),
|
|
||||||
prev_stream: z.optional(z.number()),
|
prev_stream: z.optional(z.number()),
|
||||||
prev_topic: z.optional(z.string()),
|
prev_topic: z.optional(z.string()),
|
||||||
stream: z.optional(z.number()),
|
stream: z.optional(z.number()),
|
||||||
|
|||||||
@@ -10,7 +10,6 @@ export const message_edit_history_schema = z.array(
|
|||||||
z.object({
|
z.object({
|
||||||
prev_content: z.optional(z.string()),
|
prev_content: z.optional(z.string()),
|
||||||
prev_rendered_content: z.optional(z.string()),
|
prev_rendered_content: z.optional(z.string()),
|
||||||
prev_rendered_content_version: z.optional(z.number()),
|
|
||||||
prev_stream: z.optional(z.number()),
|
prev_stream: z.optional(z.number()),
|
||||||
prev_topic: z.optional(z.string()),
|
prev_topic: z.optional(z.string()),
|
||||||
stream: z.optional(z.number()),
|
stream: z.optional(z.number()),
|
||||||
|
|||||||
@@ -40,7 +40,6 @@ export type UpdateMessageEvent = {
|
|||||||
topic_links?: TopicLink[];
|
topic_links?: TopicLink[];
|
||||||
orig_content?: string;
|
orig_content?: string;
|
||||||
orig_rendered_content?: string;
|
orig_rendered_content?: string;
|
||||||
prev_rendered_content_version?: number;
|
|
||||||
content?: string;
|
content?: string;
|
||||||
rendered_content?: string;
|
rendered_content?: string;
|
||||||
is_me_message?: boolean;
|
is_me_message?: boolean;
|
||||||
|
|||||||
@@ -508,7 +508,6 @@ def do_update_message(
|
|||||||
target_message.rendered_content_version = markdown_version
|
target_message.rendered_content_version = markdown_version
|
||||||
event["content"] = content
|
event["content"] = content
|
||||||
event["rendered_content"] = rendering_result.rendered_content
|
event["rendered_content"] = rendering_result.rendered_content
|
||||||
event["prev_rendered_content_version"] = target_message.rendered_content_version
|
|
||||||
event["is_me_message"] = Message.is_status_message(
|
event["is_me_message"] = Message.is_status_message(
|
||||||
content, rendering_result.rendered_content
|
content, rendering_result.rendered_content
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -1674,7 +1674,6 @@ update_message_content_fields: list[tuple[str, object]] = [
|
|||||||
("is_me_message", bool),
|
("is_me_message", bool),
|
||||||
("orig_content", str),
|
("orig_content", str),
|
||||||
("orig_rendered_content", str),
|
("orig_rendered_content", str),
|
||||||
("prev_rendered_content_version", int),
|
|
||||||
]
|
]
|
||||||
|
|
||||||
update_message_content_or_embedded_data_fields: list[tuple[str, object]] = [
|
update_message_content_or_embedded_data_fields: list[tuple[str, object]] = [
|
||||||
|
|||||||
@@ -246,6 +246,10 @@ class MessageDict:
|
|||||||
else:
|
else:
|
||||||
obj["content_type"] = "text/x-markdown"
|
obj["content_type"] = "text/x-markdown"
|
||||||
|
|
||||||
|
for item in obj.get("edit_history", []):
|
||||||
|
if "prev_rendered_content_version" in item:
|
||||||
|
del item["prev_rendered_content_version"]
|
||||||
|
|
||||||
if not keep_rendered_content:
|
if not keep_rendered_content:
|
||||||
del obj["rendered_content"]
|
del obj["rendered_content"]
|
||||||
del obj["sender_realm_id"]
|
del obj["sender_realm_id"]
|
||||||
|
|||||||
@@ -2369,6 +2369,10 @@ paths:
|
|||||||
message.
|
message.
|
||||||
|
|
||||||
[inline-url-previews]: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html#inline-url-previews
|
[inline-url-previews]: https://zulip.readthedocs.io/en/latest/subsystems/sending-messages.html#inline-url-previews
|
||||||
|
|
||||||
|
**Changes**: In Zulip 10.0 (feature level 284), removed the
|
||||||
|
`prev_rendered_content_version` field as it is an internal
|
||||||
|
server implementation detail not used by any client.
|
||||||
properties:
|
properties:
|
||||||
id:
|
id:
|
||||||
$ref: "#/components/schemas/EventIdSchema"
|
$ref: "#/components/schemas/EventIdSchema"
|
||||||
@@ -2589,14 +2593,6 @@ paths:
|
|||||||
|
|
||||||
The original content of the message with ID `message_id`
|
The original content of the message with ID `message_id`
|
||||||
immediately prior to this edit, rendered as HTML.
|
immediately prior to this edit, rendered as HTML.
|
||||||
prev_rendered_content_version:
|
|
||||||
type: integer
|
|
||||||
description: |
|
|
||||||
Only present if this event changed the message content.
|
|
||||||
|
|
||||||
The Markdown processor version number for the pre-edit message.
|
|
||||||
|
|
||||||
Clients should ignore this field.
|
|
||||||
content:
|
content:
|
||||||
type: string
|
type: string
|
||||||
description: |
|
description: |
|
||||||
@@ -2644,7 +2640,6 @@ paths:
|
|||||||
"orig_rendered_content": "<p>hello</p>",
|
"orig_rendered_content": "<p>hello</p>",
|
||||||
"content": "new content",
|
"content": "new content",
|
||||||
"rendered_content": "<p>new content</p>",
|
"rendered_content": "<p>new content</p>",
|
||||||
"prev_rendered_content_version": 1,
|
|
||||||
"is_me_message": false,
|
"is_me_message": false,
|
||||||
"propagate_mode": "change_all",
|
"propagate_mode": "change_all",
|
||||||
"stream_id": 5,
|
"stream_id": 5,
|
||||||
@@ -21825,13 +21820,6 @@ components:
|
|||||||
Only present if message's content was edited.
|
Only present if message's content was edited.
|
||||||
|
|
||||||
The rendered HTML representation of `prev_content`.
|
The rendered HTML representation of `prev_content`.
|
||||||
prev_rendered_content_version:
|
|
||||||
type: integer
|
|
||||||
description: |
|
|
||||||
Only present if message's content was edited.
|
|
||||||
|
|
||||||
The Markdown processor version number for the message
|
|
||||||
immediately prior to this edit event.
|
|
||||||
prev_stream:
|
prev_stream:
|
||||||
type: integer
|
type: integer
|
||||||
description: |
|
description: |
|
||||||
@@ -21908,6 +21896,10 @@ components:
|
|||||||
will be present in addition to `user_id` and `timestamp`.
|
will be present in addition to `user_id` and `timestamp`.
|
||||||
|
|
||||||
[disable-edit-history]: /help/disable-message-edit-history
|
[disable-edit-history]: /help/disable-message-edit-history
|
||||||
|
|
||||||
|
**Changes**: In Zulip 10.0 (feature level 284), removed the
|
||||||
|
`prev_rendered_content_version` field as it is an internal
|
||||||
|
server implementation detail not used by any client.
|
||||||
id:
|
id:
|
||||||
type: integer
|
type: integer
|
||||||
description: |
|
description: |
|
||||||
|
|||||||
@@ -67,9 +67,14 @@ class EditMessageTest(ZulipTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
if msg.edit_history:
|
if msg.edit_history:
|
||||||
|
message_edit_history = orjson.loads(msg.edit_history)
|
||||||
|
for item in message_edit_history:
|
||||||
|
if "prev_rendered_content_version" in item:
|
||||||
|
del item["prev_rendered_content_version"]
|
||||||
|
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
fetch_message_dict["edit_history"],
|
fetch_message_dict["edit_history"],
|
||||||
orjson.loads(msg.edit_history),
|
message_edit_history,
|
||||||
)
|
)
|
||||||
|
|
||||||
def test_edit_message_no_changes(self) -> None:
|
def test_edit_message_no_changes(self) -> None:
|
||||||
|
|||||||
Reference in New Issue
Block a user