diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 1c2e3ed371..58651c8c5e 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -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 diff --git a/zerver/tests/test_events.py b/zerver/tests/test_events.py index 023c154638..8716f46bf3 100644 --- a/zerver/tests/test_events.py +++ b/zerver/tests/test_events.py @@ -2464,6 +2464,7 @@ class EventsRegisterTest(ZulipTestCase): ('type', equals('delete_message')), ('message_id', check_int), ('sender', check_string), + ('sender_id', check_int), ('message_type', equals("stream")), ('stream_id', check_int), ('topic', check_string), @@ -2482,8 +2483,9 @@ class EventsRegisterTest(ZulipTestCase): ('type', equals('delete_message')), ('message_id', check_int), ('sender', check_string), + ('sender_id', check_int), ('message_type', equals("private")), - ('recipient_user_ids', check_int), + ('recipient_id', check_int), ]) msg_id = self.send_personal_message( self.example_email("cordelia"),