diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 5be6173f34..b9c2f30a54 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -600,7 +600,7 @@ def recipient_for_emails(emails, not_forged_mirror_message, if len(realm_domains) == 2: # I'm assuming that cross-realm PMs with the "admin realm" are rare, and therefore can be slower admin_realm = Realm.objects.get(domain=settings.ADMIN_DOMAIN) - admin_realm_admin_emails = [u.email for u in admin_realm.get_admin_users()] + admin_realm_admin_emails = {u.email for u in admin_realm.get_admin_users()} # We allow settings.CROSS_REALM_BOT_EMAILS for the hardcoded emails for the feedback and notification bots if not (normalized_emails & admin_realm_admin_emails or normalized_emails & settings.CROSS_REALM_BOT_EMAILS): raise ValidationError("You can't send private messages outside of your organization.")