do_make_stream_web_public: Update all affected fields.

Convert this function that absolutely makes a stream web public.
We already have do_change_stream_invite_only to convert
streams to public and private streams.

We also update all the fields that should be set when a stream
is made web public.
This commit is contained in:
Aman Agrawal
2020-11-10 18:37:41 +05:30
committed by Tim Abbott
parent 70c0abc2e5
commit cba766f66f
3 changed files with 12 additions and 10 deletions

View File

@@ -4569,9 +4569,11 @@ def do_change_stream_invite_only(
send_event(stream.realm, event, can_access_stream_user_ids(stream))
def do_change_stream_web_public(stream: Stream, is_web_public: bool) -> None:
stream.is_web_public = is_web_public
stream.save(update_fields=["is_web_public"])
def do_make_stream_web_public(stream: Stream) -> None:
stream.is_web_public = True
stream.invite_only = False
stream.history_public_to_subscribers = True
stream.save(update_fields=["invite_only", "history_public_to_subscribers", "is_web_public"])
def do_change_stream_post_policy(stream: Stream, stream_post_policy: int) -> None: