api: Move cross_realm_bots into the register_ret response.

This is probably not the right long-term solution to the cross-realm
bots problem (that solution is probably to eliminate cross-realm bots
and replace them with per-realm bots).  But in the short term, this
will at least make it possible for mobile apps to interact with these
cross-realm bots using the `realm_user` data set.
This commit is contained in:
Tim Abbott 2017-05-16 20:23:13 -07:00
parent 4f358f4034
commit 850519b314
2 changed files with 3 additions and 3 deletions

View File

@ -26,7 +26,7 @@ from zerver.lib.realm_icon import realm_icon_url
from zerver.lib.request import JsonableError
from zerver.lib.actions import validate_user_access_to_subscribers_helper, \
do_get_streams, get_default_streams_for_realm, \
gather_subscriptions_helper, \
gather_subscriptions_helper, get_cross_realm_dicts, \
get_status_dict, streams_to_dicts_sorted
from zerver.tornado.event_queue import request_event_queue, get_user_events
from zerver.models import Client, Message, Realm, UserPresence, UserProfile, \
@ -131,6 +131,7 @@ def fetch_initial_state_data(user_profile, event_types, queue_id,
state['avatar_url_medium'] = avatar_url(user_profile, medium=True)
state['avatar_url'] = avatar_url(user_profile)
state['can_create_streams'] = user_profile.can_create_streams()
state['cross_realm_bots'] = list(get_cross_realm_dicts())
state['is_admin'] = user_profile.is_realm_admin
state['user_id'] = user_profile.id
state['enter_sends'] = user_profile.enter_sends

View File

@ -19,7 +19,7 @@ from zerver.models import Message, UserProfile, Stream, Subscription, Huddle, \
get_realm_domains
from zerver.lib.events import do_events_register
from zerver.lib.actions import update_user_presence, do_change_tos_version, \
do_update_pointer, get_cross_realm_dicts, realm_user_count
do_update_pointer, realm_user_count
from zerver.lib.avatar import avatar_url
from zerver.lib.i18n import get_language_list, get_language_name, \
get_language_list_for_templates
@ -208,7 +208,6 @@ def home_real(request):
needs_tutorial = needs_tutorial,
first_in_realm = first_in_realm,
prompt_for_invites = prompt_for_invites,
cross_realm_bots = list(get_cross_realm_dicts()),
unread_count = approximate_unread_count(user_profile),
furthest_read_time = sent_time_in_epoch_seconds(latest_read),
has_mobile_devices = num_push_devices_for_user(user_profile) > 0,