Zulip server and web application. Open-source team chat that helps teams stay productive and focused.
bots: Replace some redundant logic with is_cross_realm_bot_email.
Mateusz Mandera29589a69eb3a
diff --git a/zerver/lib/users.py b/zerver/lib/users.pyindex 92075ec1937..3f8bd2ad41a 100644--- a/zerver/lib/users.py+++ b/zerver/lib/users.py@@ -35,6 +35,7 @@ from zerver.models import (get_realm_user_dicts,get_user,get_user_profile_by_id_in_realm,+ is_cross_realm_bot_email,)@@ -487,7 +488,7 @@ def format_user_row(if is_bot:result["bot_type"] = row["bot_type"]- if row["email"] in settings.CROSS_REALM_BOT_EMAILS:+ if is_cross_realm_bot_email(row["email"]):result["is_system_bot"] = True# Note that bot_owner_id can be None with legacy data.diff --git a/zerver/models.py b/zerver/models.pyindex 9ede2165f20..1ee6474c091 100644--- a/zerver/models.py+++ b/zerver/models.py@@ -3872,8 +3872,8 @@ def get_user_by_id_in_realm_including_cross_realm(return user_profile# Note: This doesn't validate whether the `realm` passed in is- # None/invalid for the CROSS_REALM_BOT_EMAILS case.- if user_profile.delivery_email in settings.CROSS_REALM_BOT_EMAILS:+ # None/invalid for the is_cross_realm_bot_email case.+ if is_cross_realm_bot_email(user_profile.delivery_email):return user_profileraise UserProfile.DoesNotExist()