streams: Pass stream_weekly_traffic field in stream objects.

This commit adds code to pass stream traffic data using
the "stream_weekly_traffic" field in stream objects.

We already include the traffic data in Subscription objects,
but the traffic data does not depend on the user to stream
relationship and is stream-only information, so it's better
to include it in Stream objects. We may remove the traffic
data and other stream information fields for Subscription
objects in future.

This will help clients to correctly display the stream
traffic data in case where client receives a stream
creation event and no subscription event, for an already
existing stream which the user did not have access to before.
This commit is contained in:
Sahil Batra
2023-07-27 20:12:21 +05:30
committed by Tim Abbott
parent 261fca11ec
commit ae72151ec1
15 changed files with 176 additions and 50 deletions

View File

@@ -1249,7 +1249,7 @@ class FetchQueriesTest(ZulipTestCase):
self.login_user(user)
flush_per_request_caches()
with self.assert_database_query_count(38):
with self.assert_database_query_count(39):
with mock.patch("zerver.lib.events.always_want") as want_mock:
fetch_initial_state_data(user)
@@ -1279,7 +1279,7 @@ class FetchQueriesTest(ZulipTestCase):
recent_private_conversations=1,
scheduled_messages=1,
starred_messages=1,
stream=2,
stream=3,
stop_words=0,
subscription=4,
update_display_settings=0,