emails: Move enqueue_welcome_emails outside of signups queue.

The only thing this queue should do is sign you up for the newsletter, since
it is only populated if newsletter_data is not None.
This commit is contained in:
Rishi Gupta 2017-09-21 19:23:14 -07:00 committed by Tim Abbott
parent 395a71a433
commit a7c8770f97
3 changed files with 4 additions and 4 deletions

View File

@ -93,7 +93,8 @@ from zerver.lib.utils import log_statsd_event, statsd
from zerver.lib.html_diff import highlight_html_differences
from zerver.lib.alert_words import user_alert_words, add_user_alert_words, \
remove_user_alert_words, set_user_alert_words
from zerver.lib.notifications import clear_scheduled_emails, clear_scheduled_invitation_emails
from zerver.lib.notifications import clear_scheduled_emails, \
clear_scheduled_invitation_emails, enqueue_welcome_emails
from zerver.lib.narrow import check_supported_events_narrow_filter
from zerver.lib.exceptions import JsonableError, ErrorCode
from zerver.lib.sessions import delete_user_sessions
@ -355,6 +356,7 @@ def process_new_human_user(user_profile, prereg_user=None, newsletter_data=None)
PreregistrationUser.objects.filter(email__iexact=user_profile.email).update(status=0)
notify_new_user(user_profile)
enqueue_welcome_emails(user_profile.id)
if newsletter_data is not None:
# If the user was created automatically via the API, we may

View File

@ -314,7 +314,7 @@ class LoginTest(ZulipTestCase):
with queries_captured() as queries:
self.register(self.nonreg_email('test'), "test")
# Ensure the number of queries we make is not O(streams)
self.assert_length(queries, 63)
self.assert_length(queries, 68)
user_profile = self.nonreg_user('test')
self.assertEqual(get_session_dict_user(self.client.session), user_profile.id)
self.assertFalse(user_profile.enable_stream_desktop_notifications)

View File

@ -167,8 +167,6 @@ class SignupWorker(QueueProcessingWorker):
else:
r.raise_for_status()
enqueue_welcome_emails(data['user_id'])
@assign_queue('invites')
class ConfirmationEmailWorker(QueueProcessingWorker):
def consume(self, data):