events: Remove `sender_id` from `delete_message` event.

Remove `sender_id` as part of responses from `/events`
api for `delete_message` event when `message_type` is
`private`.
This commit is contained in:
Gaurav Pandey 2021-06-12 20:05:17 +05:30 committed by Tim Abbott
parent bc131c1636
commit d2074fc10c
5 changed files with 12 additions and 13 deletions

View File

@ -11,6 +11,12 @@ below features are supported.
## Changes in Zulip 5.0
**Feature level 77**
* [`GET /events`](/api/get-events): Removed `recipient_id` and
`sender_id` field in responses of `delete_message` event when
`message_type` is `private`.
**Feature level 76**
* [`POST /fetch_api_key`](/api/fetch_api_key), [`POST

View File

@ -33,7 +33,7 @@ DESKTOP_WARNING_VERSION = "5.4.3"
# Changes should be accompanied by documentation explaining what the
# new level means in templates/zerver/api/changelog.md, as well as
# "**Changes**" entries in the endpoint's documentation in `zulip.yaml`.
API_FEATURE_LEVEL = 76
API_FEATURE_LEVEL = 77
# 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

View File

@ -5896,7 +5896,6 @@ class DeleteMessagesEvent(TypedDict, total=False):
type: str
message_ids: List[int]
message_type: str
sender_id: int
topic: str
stream_id: int
@ -6323,8 +6322,6 @@ def do_delete_messages(realm: Realm, messages: Iterable[Message]) -> None:
message_type = "private"
ums = UserMessage.objects.filter(message_id__in=message_ids)
users_to_notify = [um.user_profile_id for um in ums]
# TODO: We should plan to remove `sender_id` here.
event["sender_id"] = sample_message.sender_id
archiving_chunk_size = retention.MESSAGE_BATCH_SIZE
if message_type == "stream":

View File

@ -230,7 +230,6 @@ delete_message_event = event_dict_type(
("message_ids", ListType(int)),
("stream_id", int),
("topic", str),
("sender_id", int),
],
)
_check_delete_message = make_checker(delete_message_event)
@ -252,7 +251,7 @@ def check_delete_message(
if message_type == "stream":
keys |= {"stream_id", "topic"}
elif message_type == "private":
keys |= {"sender_id"}
pass
else:
raise AssertionError("unexpected message_type")

View File

@ -1660,6 +1660,10 @@ paths:
description: |
Event sent when a message has been deleted.
Sent to all users who received the message.
**Changes**: Before Zulip 5.0 (feature level 77), events
for private messages contained additional `sender_id` and
`recipient_id` fields.
properties:
id:
$ref: "#/components/schemas/EventIdSchema"
@ -1693,12 +1697,6 @@ paths:
enum:
- private
- stream
sender_id:
type: integer
description: |
Only present for private messages.
The ID of the user who sent the private message.
stream_id:
type: integer
description: |
@ -1714,7 +1712,6 @@ paths:
example:
{
"type": "delete_message",
"sender_id": 8,
"message_type": "private",
"message_id": 37,
"id": 0,