mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 04:53:36 +00:00
actions: Improve format for delete events.
There were several problems with the old format: * The sender was not necessarily the sender; it was the person who did the deletion (which could be an organization administrator) * It didn't include the ID of the sender, just the email address. * It didn't include the recipient ID, instead having a semi-malformed recipient_type_id under the weird name recipient_user_ids. Since nothing was relying on the old behavior, we can just fix the event structure.
This commit is contained in:
@@ -4379,14 +4379,15 @@ def do_delete_messages(user_profile: UserProfile, messages: Iterable[Message]) -
|
||||
|
||||
event = {
|
||||
'type': 'delete_message',
|
||||
'sender': user_profile.email,
|
||||
'sender': message.sender.email,
|
||||
'sender_id': message.sender_id,
|
||||
'message_id': message.id,
|
||||
'message_type': message_type, } # type: Dict[str, Any]
|
||||
if message_type == "stream":
|
||||
event['stream_id'] = message.recipient.type_id
|
||||
event['topic'] = message.topic_name()
|
||||
else:
|
||||
event['recipient_user_ids'] = message.recipient.type_id
|
||||
event['recipient_id'] = message.recipient_id
|
||||
|
||||
# TODO: Each part of the following should be changed to bulk
|
||||
# queries, since right now if you delete 1000 messages, you'll
|
||||
|
||||
Reference in New Issue
Block a user