send_email: Add ScheduledEmail support for multiple recipients.

Follow up on 92dc363. This modifies the ScheduledEmail model
and send_future_email to properly support multiple recipients.

Tweaked by tabbott to add some useful explanatory comments and fix
issues with the migration.
This commit is contained in:
Raymond Akornor
2019-01-04 00:50:21 +00:00
committed by Tim Abbott
parent 8e1dff708e
commit 89351cdd19
10 changed files with 119 additions and 51 deletions

View File

@@ -731,7 +731,7 @@ def do_deactivate_user(user_profile: UserProfile,
user_profile.save(update_fields=["is_active"])
delete_user_sessions(user_profile)
clear_scheduled_emails(user_profile.id)
clear_scheduled_emails([user_profile.id])
event_time = timezone_now()
RealmAuditLog.objects.create(realm=user_profile.realm, modified_user=user_profile,
@@ -3585,7 +3585,7 @@ def do_change_notification_settings(user_profile: UserProfile, name: str, value:
# Disabling digest emails should clear a user's email queue
if name == 'enable_digest_emails' and not value:
clear_scheduled_emails(user_profile.id, ScheduledEmail.DIGEST)
clear_scheduled_emails([user_profile.id], ScheduledEmail.DIGEST)
user_profile.save(update_fields=[name])
event = {'type': 'update_global_notifications',