mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 22:13:26 +00:00
streams: Add default stream description tests and functions.
This includes making the default stream description setting into a dict. That is an API change; we'll discuss it in the changelog but it seems small enough to be OK. With some small tweaks by tabbott to remove unnecessary backwards compatibility code for the settings. Fixes #2427.
This commit is contained in:
@@ -2313,11 +2313,16 @@ def do_change_default_language(user_profile, setting_value, log=True):
|
||||
log_event(event)
|
||||
send_event(event, [user_profile.id])
|
||||
|
||||
def set_default_streams(realm, stream_names):
|
||||
# type: (Realm, Iterable[text_type]) -> None
|
||||
def set_default_streams(realm, stream_dict):
|
||||
# type: (Realm, Dict[text_type, Dict[text_type, Any]]) -> None
|
||||
DefaultStream.objects.filter(realm=realm).delete()
|
||||
for stream_name in stream_names:
|
||||
stream, _ = create_stream_if_needed(realm, stream_name)
|
||||
stream_names = []
|
||||
for name, options in stream_dict.items():
|
||||
stream_names.append(name)
|
||||
stream, _ = create_stream_if_needed(realm,
|
||||
name,
|
||||
invite_only = options["invite_only"],
|
||||
stream_description = options["description"])
|
||||
DefaultStream.objects.create(stream=stream, realm=realm)
|
||||
|
||||
# Always include the realm's default notifications streams, if it exists
|
||||
@@ -2328,7 +2333,6 @@ def set_default_streams(realm, stream_names):
|
||||
'domain': realm.domain,
|
||||
'streams': stream_names})
|
||||
|
||||
|
||||
def notify_default_streams(realm):
|
||||
# type: (Realm) -> None
|
||||
event = dict(
|
||||
|
||||
Reference in New Issue
Block a user