home.py: move people_list as realm_users to register_ret.

Simplify the page_params generation logic #3853
This commit is contained in:
fionabunny 2017-04-24 12:59:07 -07:00 committed by Tim Abbott
parent 7db8c61aac
commit 78bcbc79d6
6 changed files with 9 additions and 9 deletions

View File

@ -1,7 +1,7 @@
global.stub_out_jquery();
set_global('page_params', {
people_list: [],
realm_users: [],
});
set_global('feature_flags', {});

View File

@ -11,7 +11,7 @@ set_global('window', {
});
set_global('page_params', {
people_list: [],
realm_users: [],
realm_emoji: {
burrito: {display_url: '/static/generated/emoji/images/emoji/burrito.png',
source_url: '/static/generated/emoji/images/emoji/burrito.png'},

View File

@ -2,7 +2,7 @@ global.stub_out_jquery();
set_global('page_params', {
is_admin: false,
people_list: [],
realm_users: [],
});
add_dependencies({

View File

@ -680,7 +680,7 @@ exports.is_my_user_id = function (user_id) {
};
$(function () {
_.each(page_params.people_list, function (person) {
_.each(page_params.realm_users, function (person) {
exports.add_in_realm(person);
});
@ -693,7 +693,7 @@ $(function () {
exports.initialize_current_user(page_params.user_id);
delete page_params.people_list; // We are the only consumer of this.
delete page_params.realm_users; // We are the only consumer of this.
delete page_params.cross_realm_bots;
});

View File

@ -87,7 +87,6 @@ class HomeTest(ZulipTestCase):
"needs_tutorial",
"never_subscribed",
"notifications_stream",
"people_list",
"pm_content_in_desktop_notifications",
"poll_timeout",
"presences",
@ -123,6 +122,7 @@ class HomeTest(ZulipTestCase):
"realm_restricted_to_domain",
"realm_show_digest_email",
"realm_uri",
"realm_users",
"realm_waiting_period_threshold",
"referrals",
"save_stacktraces",
@ -316,8 +316,8 @@ class HomeTest(ZulipTestCase):
self.login(email)
result = self._get_home_page()
page_params = self._get_page_params(result)
for params in ['people_list', 'realm_bots']:
users = page_params['people_list']
for params in ['realm_users', 'realm_bots']:
users = page_params['realm_users']
self.assertTrue(len(users) >= 3)
for user in users:
self.assertEqual(user['user_id'],

View File

@ -240,7 +240,6 @@ def home_real(request):
# Realm foreign key data from register_ret.
# TODO: Rename these to match register_ret values.
people_list = register_ret['realm_users'],
initial_pointer = register_ret['pointer'],
# Misc. extra data.
@ -306,6 +305,7 @@ def home_real(request):
'realm_restricted_to_domain',
'realm_show_digest_email',
'realm_uri',
'realm_users',
'realm_waiting_period_threshold',
'referrals',
'subscriptions',