From adc987dc43f6733e1c751100373f1f90dfee31a2 Mon Sep 17 00:00:00 2001 From: Alex Vandiver Date: Mon, 21 Aug 2023 18:19:35 +0000 Subject: [PATCH] send_email: Use a consistent order when sending custom emails to users. --- zerver/lib/send_email.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zerver/lib/send_email.py b/zerver/lib/send_email.py index c904de3696..a55add6048 100644 --- a/zerver/lib/send_email.py +++ b/zerver/lib/send_email.py @@ -559,7 +559,7 @@ def send_custom_email( f.write(get_header(options.get("subject"), parsed_email_template.get("subject"), "subject")) # Finally, we send the actual emails. - for user_profile in users.select_related("realm"): + for user_profile in users.select_related("realm").order_by("id"): if options.get("admins_only") and not user_profile.is_realm_admin: continue context: Dict[str, Union[List[str], str]] = {