mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 06:53:25 +00:00
messages: Optimize check_message using recent denormalization.
This commit is contained in:
committed by
Tim Abbott
parent
1c5461663f
commit
792fbeea24
@@ -2356,7 +2356,7 @@ def check_message(sender: UserProfile, client: Client, addressee: Addressee,
|
||||
stream = addressee.stream()
|
||||
assert stream is not None
|
||||
|
||||
recipient = get_stream_recipient(stream.id)
|
||||
recipient = stream.recipient
|
||||
|
||||
# This will raise JsonableError if there are problems.
|
||||
validate_sender_can_write_to_stream(
|
||||
|
||||
@@ -2403,7 +2403,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
streams_to_sub,
|
||||
dict(principals=ujson.dumps([user1.email, user2.email])),
|
||||
)
|
||||
self.assert_length(queries, 45)
|
||||
self.assert_length(queries, 44)
|
||||
|
||||
self.assert_length(events, 7)
|
||||
for ev in [x for x in events if x['event']['type'] not in ('message', 'stream')]:
|
||||
@@ -3143,7 +3143,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
[new_streams[0]],
|
||||
dict(principals=ujson.dumps([user1.email, user2.email])),
|
||||
)
|
||||
self.assert_length(queries, 45)
|
||||
self.assert_length(queries, 44)
|
||||
|
||||
# Test creating private stream.
|
||||
with queries_captured() as queries:
|
||||
@@ -3153,7 +3153,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
dict(principals=ujson.dumps([user1.email, user2.email])),
|
||||
invite_only=True,
|
||||
)
|
||||
self.assert_length(queries, 40)
|
||||
self.assert_length(queries, 39)
|
||||
|
||||
# Test creating a public stream with announce when realm has a notification stream.
|
||||
notifications_stream = get_stream(self.streams[0], self.test_realm)
|
||||
@@ -3168,7 +3168,7 @@ class SubscriptionAPITest(ZulipTestCase):
|
||||
principals=ujson.dumps([user1.email, user2.email])
|
||||
)
|
||||
)
|
||||
self.assert_length(queries, 54)
|
||||
self.assert_length(queries, 53)
|
||||
|
||||
class GetBotOwnerStreamsTest(ZulipTestCase):
|
||||
def test_streams_api_for_bot_owners(self) -> None:
|
||||
|
||||
Reference in New Issue
Block a user