From 15a8d5acc116ab5f2047056d5a3cdf93ac8e6e40 Mon Sep 17 00:00:00 2001 From: Rishi Gupta Date: Mon, 13 Mar 2017 10:29:31 -0700 Subject: [PATCH] actions: Modify recipient_for_emails to not use Realm.domain. Realm.domain was just being used as a unique identifier for a Realm. --- zerver/lib/actions.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/zerver/lib/actions.py b/zerver/lib/actions.py index 46aba3d996..f246f0ae10 100644 --- a/zerver/lib/actions.py +++ b/zerver/lib/actions.py @@ -1075,11 +1075,11 @@ def recipient_for_emails(emails, not_forged_mirror_message, recipient_profile_ids = set() # We exempt cross-realm bots from the check that all the recipients - # are in the same domain. - realm_domains = set() + # are in the same realm. + realms = set() exempt_emails = get_cross_realm_emails() if sender.email not in exempt_emails: - realm_domains.add(sender.realm.domain) + realms.add(sender.realm_id) for email in emails: try: @@ -1091,12 +1091,12 @@ def recipient_for_emails(emails, not_forged_mirror_message, raise ValidationError(_("'%s' is no longer using Zulip.") % (email,)) recipient_profile_ids.add(user_profile.id) if email not in exempt_emails: - realm_domains.add(user_profile.realm.domain) + realms.add(user_profile.realm_id) if not_forged_mirror_message and user_profile.id not in recipient_profile_ids: raise ValidationError(_("User not authorized for this query")) - if len(realm_domains) > 1: + if len(realms) > 1: raise ValidationError(_("You can't send private messages outside of your organization.")) # If the private message is just between the sender and