welcome-emails: Separate followup_day1 email from other welcome emails.

The initial followup_day1 email confirms that the new user account
has been successfully created and should be sent to the user
independently of an organization's setting for send_welcome_emails.

Here we separate out the followup_day1 email into a separate function
from enqueue_welcome_emails and create a helper function for setting
the shared welcome email sender information.

The followup_day1 email is still a scheduled email so that the initial
account creation and log-in process for the user remains unchanged.

Fixes #25268.
This commit is contained in:
Lauryn Menard
2023-06-30 13:27:25 +02:00
committed by Tim Abbott
parent 0e1acd595b
commit 3dfdbbc775
5 changed files with 63 additions and 36 deletions

View File

@@ -1134,9 +1134,9 @@ class EmailUnsubscribeTests(ZulipTestCase):
click even when logged out to stop receiving them.
"""
user_profile = self.example_user("hamlet")
# Simulate a new user signing up, which enqueues 3 welcome e-mails.
# Simulate scheduling welcome e-mails for a new user.
enqueue_welcome_emails(user_profile)
self.assertEqual(3, ScheduledEmail.objects.filter(users=user_profile).count())
self.assertEqual(2, ScheduledEmail.objects.filter(users=user_profile).count())
# Simulate unsubscribing from the welcome e-mails.
unsubscribe_link = one_click_unsubscribe_link(user_profile, "welcome")