onboarding: Refactor away setup_initial_private_stream.

It is a confusing name, now that the stream creation part has been taken
away.
This commit is contained in:
Rishi Gupta 2017-11-19 19:14:17 -08:00 committed by Tim Abbott
parent 3d17897563
commit 42652713c8
3 changed files with 6 additions and 11 deletions

View File

@ -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)

View File

@ -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:

View File

@ -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)