mirror of
https://github.com/zulip/zulip.git
synced 2025-11-11 17:36:27 +00:00
actions: Call send_initial_pms from process_new_human_user.
This commit is contained in:
@@ -353,6 +353,11 @@ def process_new_human_user(user_profile, prereg_user=None, newsletter_data=None)
|
||||
notify_new_user(user_profile)
|
||||
enqueue_welcome_emails(user_profile)
|
||||
|
||||
# We have an import loop here; it's intentional, because we want
|
||||
# to keep all the onboarding code in zerver/lib/onboarding.py.
|
||||
from zerver.lib.onboarding import send_initial_pms
|
||||
send_initial_pms(user_profile)
|
||||
|
||||
if newsletter_data is not None:
|
||||
# If the user was created automatically via the API, we may
|
||||
# not want to register them for the newsletter
|
||||
|
||||
@@ -26,7 +26,7 @@ from zerver.forms import RegistrationForm, HomepageForm, RealmCreationForm, \
|
||||
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 send_initial_pms, setup_initial_streams, \
|
||||
from zerver.lib.onboarding import setup_initial_streams, \
|
||||
setup_initial_private_stream, send_initial_realm_messages
|
||||
from zerver.lib.response import json_success
|
||||
from zerver.lib.subdomains import get_subdomain, is_root_domain_available
|
||||
@@ -232,12 +232,6 @@ def accounts_register(request):
|
||||
timezone=timezone,
|
||||
newsletter_data={"IP": request.META['REMOTE_ADDR']})
|
||||
|
||||
# Note: Any logic like this must also be replicated in
|
||||
# ZulipLDAPAuthBackend and zerver/views/users.py. This is
|
||||
# ripe for a refactoring, though care is required to avoid
|
||||
# import loops with zerver/lib/actions.py and zerver/lib/onboarding.py.
|
||||
send_initial_pms(user_profile)
|
||||
|
||||
if realm_creation:
|
||||
setup_initial_private_stream(user_profile)
|
||||
send_initial_realm_messages(realm)
|
||||
|
||||
@@ -18,7 +18,6 @@ from zerver.lib.actions import do_change_avatar_fields, do_change_bot_owner, \
|
||||
do_change_default_events_register_stream, do_change_default_sending_stream, \
|
||||
do_create_user, do_deactivate_user, do_reactivate_user, do_regenerate_api_key
|
||||
from zerver.lib.avatar import avatar_url, get_gravatar_url, get_avatar_field
|
||||
from zerver.lib.onboarding import send_initial_pms
|
||||
from zerver.lib.response import json_error, json_success
|
||||
from zerver.lib.streams import access_stream_by_name
|
||||
from zerver.lib.upload import upload_avatar_image
|
||||
@@ -426,8 +425,7 @@ def create_user_backend(request, user_profile, email=REQ(), password=REQ(),
|
||||
except UserProfile.DoesNotExist:
|
||||
pass
|
||||
|
||||
new_user_profile = do_create_user(email, password, realm, full_name, short_name)
|
||||
send_initial_pms(new_user_profile)
|
||||
do_create_user(email, password, realm, full_name, short_name)
|
||||
return json_success()
|
||||
|
||||
def generate_client_id():
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
from django.core.management.base import BaseCommand
|
||||
from zerver.lib.actions import do_create_user, do_create_realm
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.onboarding import send_initial_pms, setup_initial_streams, \
|
||||
from zerver.lib.onboarding import setup_initial_streams, \
|
||||
setup_initial_private_stream, send_initial_realm_messages
|
||||
from zerver.models import Realm, UserProfile
|
||||
|
||||
@@ -21,7 +21,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)
|
||||
send_initial_pms(user)
|
||||
setup_initial_private_stream(user)
|
||||
|
||||
send_initial_realm_messages(realm)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
from django.core.management.base import BaseCommand, CommandParser
|
||||
from zerver.lib.actions import do_create_user
|
||||
from zerver.lib.management import ZulipBaseCommand
|
||||
from zerver.lib.onboarding import send_initial_pms
|
||||
from zerver.models import Realm, UserProfile
|
||||
|
||||
from typing import Any
|
||||
@@ -30,6 +29,4 @@ and will otherwise fall back to the zulip realm."""
|
||||
domain = realm.string_id + '.zulip.com'
|
||||
|
||||
name = '%02d-user' % (UserProfile.objects.filter(email__contains='user@').count(),)
|
||||
user = do_create_user('%s@%s' % (name, domain),
|
||||
'password', realm, name, name)
|
||||
send_initial_pms(user)
|
||||
do_create_user('%s@%s' % (name, domain), 'password', realm, name, name)
|
||||
|
||||
@@ -19,7 +19,6 @@ from social_django.models import DjangoStorage
|
||||
from social_django.strategy import DjangoStrategy
|
||||
|
||||
from zerver.lib.actions import do_create_user
|
||||
from zerver.lib.onboarding import send_initial_pms
|
||||
from zerver.lib.request import JsonableError
|
||||
from zerver.lib.subdomains import check_subdomain, get_subdomain
|
||||
from zerver.lib.users import check_full_name
|
||||
@@ -473,7 +472,6 @@ class ZulipLDAPAuthBackend(ZulipLDAPAuthBackendBase):
|
||||
short_name = ldap_user.attrs[short_name_attr][0]
|
||||
|
||||
user_profile = do_create_user(username, None, self._realm, full_name, short_name)
|
||||
send_initial_pms(user_profile)
|
||||
|
||||
return user_profile, True
|
||||
|
||||
|
||||
Reference in New Issue
Block a user