Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

populate_db: Add users to initial private stream in mit and lear realm.

Sahil Batra6e8523015c80
diff --git a/zilencer/management/commands/populate_db.py b/zilencer/management/commands/populate_db.py
index b427ac92c37..9c134ebd8cb 100644
--- a/zilencer/management/commands/populate_db.py
+++ b/zilencer/management/commands/populate_db.py
@@ -26,6 +26,7 @@ from zerver.actions.custom_profile_fields import (
)
from zerver.actions.message_send import build_message_send_dict, do_send_messages
from zerver.actions.realm_emoji import check_add_realm_emoji
+from zerver.actions.streams import bulk_add_subscriptions
from zerver.actions.users import do_change_user_role
from zerver.lib.bulk_create import bulk_create_streams
from zerver.lib.generate_test_data import create_test_data, generate_topics
@@ -825,6 +826,7 @@ class Command(BaseCommand):
if options["test_suite"]:
# Create test users; the MIT ones are needed to test
# the Zephyr mirroring codepaths.
+ event_time = timezone_now()
testsuite_mit_users = [
("Fred Sipb (MIT)", "[email protected]"),
("Athena Consulting Exchange User (MIT)", "[email protected]"),
@@ -834,6 +836,12 @@ class Command(BaseCommand):
mit_realm, testsuite_mit_users, tos_version=settings.TERMS_OF_SERVICE_VERSION
)
+ mit_user = get_user_by_delivery_email("[email protected]", mit_realm)
+ mit_signup_stream = Stream.objects.get(
+ name=Realm.INITIAL_PRIVATE_STREAM_NAME, realm=mit_realm
+ )
+ bulk_add_subscriptions(mit_realm, [mit_signup_stream], [mit_user], acting_user=None)
+
testsuite_lear_users = [
("King Lear", "[email protected]"),
("Cordelia, Lear's daughter", "[email protected]"),
@@ -842,6 +850,14 @@ class Command(BaseCommand):
lear_realm, testsuite_lear_users, tos_version=settings.TERMS_OF_SERVICE_VERSION
)
+ lear_user = get_user_by_delivery_email("[email protected]", lear_realm)
+ lear_signup_stream = Stream.objects.get(
+ name=Realm.INITIAL_PRIVATE_STREAM_NAME, realm=lear_realm
+ )
+ bulk_add_subscriptions(
+ lear_realm, [lear_signup_stream], [lear_user], acting_user=None
+ )
+
if not options["test_suite"]:
# To keep the messages.json fixtures file for the test
# suite fast, don't add these users and subscriptions