send_email: Change clear_scheduled_emails to only take one user.

No codepath except tests passes in more than one user_profile -- and
doing so is what makes the deduplication necessary.

Simplify the API by making it only take one user_profile id.
This commit is contained in:
Alex Vandiver
2021-08-14 00:54:46 +00:00
committed by Tim Abbott
parent 6fbe7ad61e
commit ebaafb32f3
4 changed files with 8 additions and 24 deletions

View File

@@ -1214,7 +1214,7 @@ def do_deactivate_user(
change_user_is_active(user_profile, False)
delete_user_sessions(user_profile)
clear_scheduled_emails([user_profile.id])
clear_scheduled_emails(user_profile.id)
event_time = timezone_now()
RealmAuditLog.objects.create(
@@ -5036,7 +5036,7 @@ def do_change_notification_settings(
# 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 = {