mirror of
https://github.com/zulip/zulip.git
synced 2025-11-02 13:03:29 +00:00
Don't allow sending messages to deactivated users or realms
We still don't show this in the frontend, aside from our usual "Not delivered" message that we also show when you send to a non-existent user. Addresses #2349 (imported from commit 2f348b15a4d539987ddbcccbbf40e2be87c1f92d)
This commit is contained in:
@@ -547,6 +547,9 @@ def recipient_for_emails(emails, not_forged_mirror_message,
|
||||
user_profile = get_user_profile_by_email(email)
|
||||
except UserProfile.DoesNotExist:
|
||||
raise ValidationError("Invalid email '%s'" % (email,))
|
||||
if (not user_profile.is_active and not user_profile.is_mirror_dummy) or \
|
||||
user_profile.realm.deactivated:
|
||||
raise ValidationError("'%s' is no longer using Zulip." % (email,))
|
||||
recipient_profile_ids.add(user_profile.id)
|
||||
realm_domains.add(user_profile.realm.domain)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user