mirror of https://github.com/zulip/zulip.git
do_make_stream_public: Accept a stream object, not a name.
This commit is contained in:
parent
54bcc675f7
commit
0a75480444
|
@ -2052,17 +2052,8 @@ def do_change_bot_type(user_profile, value):
|
|||
user_profile.bot_type = value
|
||||
user_profile.save(update_fields=["bot_type"])
|
||||
|
||||
def do_make_stream_public(user_profile, realm, stream_name):
|
||||
# type: (UserProfile, Realm, Text) -> None
|
||||
stream_name = stream_name.strip()
|
||||
stream = get_stream(stream_name, realm)
|
||||
|
||||
if not stream:
|
||||
raise JsonableError(_('Unknown stream "%s"') % (stream_name,))
|
||||
|
||||
if not subscribed_to_stream(user_profile, stream):
|
||||
raise JsonableError(_('You are not invited to this stream.'))
|
||||
|
||||
def do_make_stream_public(realm, stream):
|
||||
# type: (Realm, Stream) -> None
|
||||
stream.invite_only = False
|
||||
stream.save(update_fields=['invite_only'])
|
||||
|
||||
|
|
|
@ -100,7 +100,7 @@ def update_stream_backend(request, user_profile, stream_id,
|
|||
if is_private:
|
||||
do_make_stream_private(user_profile.realm, stream.name)
|
||||
else:
|
||||
do_make_stream_public(user_profile, user_profile.realm, stream.name)
|
||||
do_make_stream_public(user_profile.realm, stream)
|
||||
return json_success()
|
||||
|
||||
def list_subscriptions_backend(request, user_profile):
|
||||
|
|
Loading…
Reference in New Issue