mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
settings: Add setting for SYSTEM_BOT_REALM.
This fixes some subtle JavaScript exceptions we've been getting in zulipchat.com, caused by the system bot realm there not being "zulip" interacting with get_cross_realm_users.
This commit is contained in:
@@ -3889,7 +3889,7 @@ def get_cross_realm_dicts():
|
||||
# type: () -> List[Dict[str, Any]]
|
||||
users = bulk_get_users(list(get_cross_realm_emails()), None,
|
||||
base_query=UserProfile.objects.filter(
|
||||
realm__string_id="zulip")).values()
|
||||
realm__string_id=settings.SYSTEM_BOT_REALM)).values()
|
||||
return [{'email': user.email,
|
||||
'user_id': user.id,
|
||||
'is_admin': user.is_realm_admin,
|
||||
@@ -3899,7 +3899,7 @@ def get_cross_realm_dicts():
|
||||
# Important: We filter here, is addition to in
|
||||
# `base_query`, because of how bulk_get_users shares its
|
||||
# cache with other UserProfile caches.
|
||||
if user.realm.string_id == 'zulip']
|
||||
if user.realm.string_id == settings.SYSTEM_BOT_REALM]
|
||||
|
||||
def do_send_confirmation_email(invitee, referrer, body):
|
||||
# type: (PreregistrationUser, UserProfile, Optional[str]) -> None
|
||||
|
||||
@@ -585,7 +585,7 @@ def fetch_user_profile(response: TableData, config: Config, context: Context) ->
|
||||
def fetch_user_profile_cross_realm(response: TableData, config: Config, context: Context) -> None:
|
||||
realm = context['realm']
|
||||
|
||||
if realm.string_id == "zulip":
|
||||
if realm.string_id == settings.SYSTEM_BOT_REALM:
|
||||
response['zerver_userprofile_crossrealm'] = []
|
||||
else:
|
||||
response['zerver_userprofile_crossrealm'] = [dict(email=x.email, id=x.id) for x in [
|
||||
|
||||
@@ -225,6 +225,10 @@ DEFAULT_SETTINGS.update({
|
||||
'FEEDBACK_BOT': 'feedback@zulip.com',
|
||||
'FEEDBACK_BOT_NAME': 'Zulip Feedback Bot',
|
||||
'FEEDBACK_STREAM': None,
|
||||
# SYSTEM_BOT_REALM would be a constant always set to 'zulip',
|
||||
# except that it isn't that on zulipchat.com. We will likely do a
|
||||
# migration and eliminate this parameter in the future.
|
||||
'SYSTEM_BOT_REALM': 'zulip',
|
||||
|
||||
# Structurally, we will probably eventually merge
|
||||
# analytics into part of the main server, rather
|
||||
|
||||
Reference in New Issue
Block a user