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.

(cherry picked from commit ebaafb32f3)
This commit is contained in:
Alex Vandiver
2021-08-14 00:54:46 +00:00
parent 99cc5598ac
commit 7b6cee1164
4 changed files with 8 additions and 24 deletions

View File

@@ -1171,7 +1171,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(
@@ -4820,7 +4820,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 = {