mirror of https://github.com/zulip/zulip.git
events: Remove `recipient_id` from `delete_message` event.
Remove `recipient_id` from `delete_message` event response when `message_type` is `private`. API changelog updated in next commit.
This commit is contained in:
parent
ec7dc08e11
commit
bc131c1636
|
@ -5897,7 +5897,6 @@ class DeleteMessagesEvent(TypedDict, total=False):
|
|||
message_ids: List[int]
|
||||
message_type: str
|
||||
sender_id: int
|
||||
recipient_id: int
|
||||
topic: str
|
||||
stream_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_id
|
||||
event["sender_id"] = sample_message.sender_id
|
||||
archiving_chunk_size = retention.MESSAGE_BATCH_SIZE
|
||||
|
||||
|
|
|
@ -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")
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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: integer
|
||||
description: |
|
||||
|
@ -1720,7 +1714,6 @@ paths:
|
|||
example:
|
||||
{
|
||||
"type": "delete_message",
|
||||
"recipient_id": 10,
|
||||
"sender_id": 8,
|
||||
"message_type": "private",
|
||||
"message_id": 37,
|
||||
|
|
Loading…
Reference in New Issue