Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
events: Remove `recipient_id` from `delete_message` event.
Gaurav Pandeybc131c1636cf
diff --git a/zerver/lib/actions.py b/zerver/lib/actions.pyindex 2912883c7da..645612c1e81 100644--- a/zerver/lib/actions.py+++ b/zerver/lib/actions.py@@ -5897,7 +5897,6 @@ class DeleteMessagesEvent(TypedDict, total=False):message_ids: List[int]message_type: strsender_id: int- recipient_id: inttopic: strstream_id: int@@ -6325,7 +6324,6 @@ def do_delete_messages(realm: Realm, messages: Iterable[Message]) -> None: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["recipient_id"] = sample_message.recipient_idevent["sender_id"] = sample_message.sender_idarchiving_chunk_size = retention.MESSAGE_BATCH_SIZEdiff --git a/zerver/lib/event_schema.py b/zerver/lib/event_schema.pyindex ce7a2d2e263..9b01828443e 100644--- a/zerver/lib/event_schema.py+++ b/zerver/lib/event_schema.py@@ -230,7 +230,6 @@ delete_message_event = event_dict_type(("message_ids", ListType(int)),("stream_id", int),("topic", str),- ("recipient_id", int),("sender_id", int),],)@@ -253,7 +252,7 @@ def check_delete_message(if message_type == "stream":keys |= {"stream_id", "topic"}elif message_type == "private":- keys |= {"recipient_id", "sender_id"}+ keys |= {"sender_id"}else:raise AssertionError("unexpected message_type")diff --git a/zerver/lib/events.py b/zerver/lib/events.pyindex dac15702536..aaa6695501e 100644--- a/zerver/lib/events.py+++ b/zerver/lib/events.py@@ -987,23 +987,6 @@ def apply_event(if "raw_recent_private_conversations" not in state or event["message_type"] != "private":return- recipient_id = get_recent_conversations_recipient_id(- user_profile, event["recipient_id"], event["sender_id"]- )-- # Ideally, we'd have test coverage for these two blocks. To- # do that, we'll need a test where we delete not-the-latest- # messages or delete a private message not in- # recent_private_conversations.- if recipient_id not in state["raw_recent_private_conversations"]: # nocoverage- return-- old_max_message_id = state["raw_recent_private_conversations"][recipient_id][- "max_message_id"- ]- if old_max_message_id not in message_ids: # nocoverage- return-# OK, we just deleted what had been the max_message_id for# this recent conversation; we need to recompute that value# from scratch. Definitely don't need to re-query everything,diff --git a/zerver/openapi/zulip.yaml b/zerver/openapi/zulip.yamlindex 13c134c3571..adb2e77f4e8 100644--- a/zerver/openapi/zulip.yaml+++ b/zerver/openapi/zulip.yaml@@ -1693,12 +1693,6 @@ paths:enum:- private- stream- recipient_id:- type: integer- description: |- Only present for private messages.-- The ID of the user (or group of users) who received the private message.sender_id:type: integerdescription: |@@ -1720,7 +1714,6 @@ paths:example:{"type": "delete_message",- "recipient_id": 10,"sender_id": 8,"message_type": "private","message_id": 37,