diff --git a/zerver/lib/onboarding.py b/zerver/lib/onboarding.py index 09a2465106..ca6eb1302f 100644 --- a/zerver/lib/onboarding.py +++ b/zerver/lib/onboarding.py @@ -46,11 +46,6 @@ def setup_initial_streams(realm): create_streams_if_needed(realm, stream_dicts) set_default_streams(realm, {stream['name']: {} for stream in stream_dicts}) -# For the first user in a realm -def setup_initial_private_stream(user): - # type: (UserProfile) -> None - bulk_add_subscriptions([user.realm.signup_notifications_stream], [user]) - def send_initial_realm_messages(realm): # type: (Realm) -> None welcome_bot = get_system_bot(settings.WELCOME_BOT) diff --git a/zerver/views/registration.py b/zerver/views/registration.py index 153242758c..89100746a1 100644 --- a/zerver/views/registration.py +++ b/zerver/views/registration.py @@ -20,14 +20,14 @@ from zerver.lib.events import do_events_register from zerver.lib.actions import do_change_password, do_change_full_name, do_change_is_admin, \ do_activate_user, do_create_user, do_create_realm, \ user_email_is_unique, compute_mit_user_fullname, validate_email_for_realm, \ - do_set_user_display_setting, lookup_default_stream_groups + do_set_user_display_setting, lookup_default_stream_groups, bulk_add_subscriptions from zerver.forms import RegistrationForm, HomepageForm, RealmCreationForm, \ CreateUserForm, FindMyTeamForm from django_auth_ldap.backend import LDAPBackend, _LDAPUser from zerver.decorator import require_post, has_request_variables, \ JsonableError, REQ, do_login from zerver.lib.onboarding import setup_initial_streams, \ - setup_initial_private_stream, send_initial_realm_messages + send_initial_realm_messages from zerver.lib.response import json_success from zerver.lib.subdomains import get_subdomain, is_root_domain_available from zerver.lib.timezone import get_all_timezones @@ -220,7 +220,7 @@ def accounts_register(request): default_stream_groups=default_stream_groups) if realm_creation: - setup_initial_private_stream(user_profile) + bulk_add_subscriptions([realm.signup_notifications_stream], [user_profile]) send_initial_realm_messages(realm) if realm_creation: diff --git a/zilencer/management/commands/add_new_realm.py b/zilencer/management/commands/add_new_realm.py index ab87cf0e6d..ccb4583599 100644 --- a/zilencer/management/commands/add_new_realm.py +++ b/zilencer/management/commands/add_new_realm.py @@ -1,9 +1,9 @@ from typing import Any -from zerver.lib.actions import do_create_realm, do_create_user +from zerver.lib.actions import do_create_realm, do_create_user, bulk_add_subscriptions from zerver.lib.management import ZulipBaseCommand from zerver.lib.onboarding import send_initial_realm_messages, \ - setup_initial_private_stream, setup_initial_streams + setup_initial_streams from zerver.models import Realm, UserProfile class Command(ZulipBaseCommand): @@ -20,6 +20,6 @@ class Command(ZulipBaseCommand): UserProfile.objects.filter(email__contains='user@').count(),) user = do_create_user('%s@%s.zulip.com' % (name, string_id), 'password', realm, name, name, is_realm_admin=True) - setup_initial_private_stream(user) + bulk_add_subscriptions([realm.signup_notifications_stream], [user]) send_initial_realm_messages(realm)