populate_db: Fix initialization of history_public_to_subscribers.

This was being incorrectly not initialized properly in the test suite,
because we neglected to update the bulk_create code path for creating
streams.
This commit is contained in:
Tim Abbott
2018-05-02 08:46:18 -07:00
parent 866cb38270
commit 4df886f36f
2 changed files with 8 additions and 1 deletions

View File

@@ -65,11 +65,17 @@ def bulk_create_streams(realm: Realm,
.values_list('name', flat=True)]) .values_list('name', flat=True)])
streams_to_create = [] # type: List[Stream] streams_to_create = [] # type: List[Stream]
for name, options in stream_dict.items(): for name, options in stream_dict.items():
if 'history_public_to_subscribers' not in options:
options['history_public_to_subscribers'] = (
not options["invite_only"] and not realm.is_zephyr_mirror_realm)
if name.lower() not in existing_streams: if name.lower() not in existing_streams:
streams_to_create.append( streams_to_create.append(
Stream( Stream(
realm=realm, name=name, description=options["description"], realm=realm,
name=name,
description=options["description"],
invite_only=options["invite_only"], invite_only=options["invite_only"],
history_public_to_subscribers=options["history_public_to_subscribers"],
is_in_zephyr_realm=realm.is_zephyr_mirror_realm, is_in_zephyr_realm=realm.is_zephyr_mirror_realm,
) )
) )

View File

@@ -103,6 +103,7 @@ def is_template_database_current(
if check_files is None: if check_files is None:
check_files = [ check_files = [
'zilencer/management/commands/populate_db.py', 'zilencer/management/commands/populate_db.py',
'zerver/lib/bulk_create.py',
'zerver/lib/generate_test_data.py', 'zerver/lib/generate_test_data.py',
'tools/setup/postgres-init-test-db', 'tools/setup/postgres-init-test-db',
'tools/setup/postgres-init-dev-db', 'tools/setup/postgres-init-dev-db',