mirror of https://github.com/zulip/zulip.git
models: Add `is_announcement_only` to stream_dict in `actions.py`.
Adds `is_announcement_only` to `stream_dict`s in order to access the property in the frontend.
This commit is contained in:
parent
897ed17f0c
commit
295fcb8536
|
@ -2300,6 +2300,7 @@ def notify_subscriptions_added(user_profile: UserProfile,
|
|||
stream_id=stream.id,
|
||||
in_home_view=subscription.in_home_view,
|
||||
invite_only=stream.invite_only,
|
||||
is_announcement_only=stream.is_announcement_only,
|
||||
color=subscription.color,
|
||||
email_address=encode_email_address(stream),
|
||||
desktop_notifications=subscription.desktop_notifications,
|
||||
|
@ -3939,6 +3940,7 @@ def get_web_public_subs(realm: Realm) -> SubHelperT:
|
|||
{'name': stream.name,
|
||||
'in_home_view': True,
|
||||
'invite_only': False,
|
||||
'is_announcement_only': stream.is_announcement_only,
|
||||
'color': get_next_color(),
|
||||
'desktop_notifications': True,
|
||||
'audible_notifications': True,
|
||||
|
@ -3980,7 +3982,7 @@ def gather_subscriptions_helper(user_profile: UserProfile,
|
|||
stream_ids.add(sub['stream_id'])
|
||||
|
||||
all_streams = get_active_streams(user_profile.realm).select_related(
|
||||
"realm").values("id", "name", "invite_only", "realm_id",
|
||||
"realm").values("id", "name", "invite_only", "is_announcement_only", "realm_id",
|
||||
"email_token", "description", "date_created")
|
||||
|
||||
stream_dicts = [stream for stream in all_streams if stream['id'] in stream_ids]
|
||||
|
@ -4032,6 +4034,7 @@ def gather_subscriptions_helper(user_profile: UserProfile,
|
|||
stream_dict = {'name': stream["name"],
|
||||
'in_home_view': sub["in_home_view"],
|
||||
'invite_only': stream["invite_only"],
|
||||
'is_announcement_only': stream["is_announcement_only"],
|
||||
'color': sub["color"],
|
||||
'desktop_notifications': sub["desktop_notifications"],
|
||||
'audible_notifications': sub["audible_notifications"],
|
||||
|
@ -4064,6 +4067,7 @@ def gather_subscriptions_helper(user_profile: UserProfile,
|
|||
if is_public or user_profile.is_realm_admin:
|
||||
stream_dict = {'name': stream['name'],
|
||||
'invite_only': stream['invite_only'],
|
||||
'is_announcement_only': stream['is_announcement_only'],
|
||||
'stream_id': stream['id'],
|
||||
'is_old_stream': is_old_stream(stream["date_created"]),
|
||||
'stream_weekly_traffic': get_average_weekly_stream_traffic(stream["id"],
|
||||
|
|
|
@ -415,6 +415,7 @@ def apply_event(state: Dict[str, Any],
|
|||
stream_data['subscribers'] = []
|
||||
stream_data['stream_weekly_traffic'] = 0
|
||||
stream_data['is_old_stream'] = False
|
||||
stream_data['is_announcement_only'] = False
|
||||
# Add stream to never_subscribed (if not invite_only)
|
||||
state['never_subscribed'].append(stream_data)
|
||||
state['streams'].append(stream)
|
||||
|
|
|
@ -1926,6 +1926,7 @@ class EventsRegisterTest(ZulipTestCase):
|
|||
('description', check_string),
|
||||
('email_address', check_string),
|
||||
('invite_only', check_bool),
|
||||
('is_announcement_only', check_bool),
|
||||
('in_home_view', check_bool),
|
||||
('name', check_string),
|
||||
('desktop_notifications', check_bool),
|
||||
|
|
Loading…
Reference in New Issue