message: Do not include details of inaccessible users in message data.

This commit adds code to not include original details of senders like
name, email and avatar url in the message objects sent through events
and in the response of endpoint used to fetch messages.

This is the last major commit for the project to add support for
limiting guest access to an entire organization.

Fixes #10970.
This commit is contained in:
Sahil Batra
2023-11-08 09:23:05 +05:30
committed by Tim Abbott
parent 22d59f1132
commit 198568522a
10 changed files with 188 additions and 12 deletions

View File

@@ -55,7 +55,7 @@ class EditMessageTestCase(ZulipTestCase):
def check_message(self, msg_id: int, topic_name: str, content: str) -> None:
# Make sure we saved the message correctly to the DB.
msg = Message.objects.get(id=msg_id)
msg = Message.objects.select_related("realm").get(id=msg_id)
self.assertEqual(msg.topic_name(), topic_name)
self.assertEqual(msg.content, content)
@@ -75,6 +75,8 @@ class EditMessageTestCase(ZulipTestCase):
apply_markdown=False,
client_gravatar=False,
allow_edit_history=True,
user_profile=None,
realm=msg.realm,
)
self.assert_length(queries, 1)