diff --git a/frontend_tests/node_tests/presence_list_performance.js b/frontend_tests/node_tests/presence_list_performance.js index 4e95574edd..94a7a52b04 100644 --- a/frontend_tests/node_tests/presence_list_performance.js +++ b/frontend_tests/node_tests/presence_list_performance.js @@ -45,7 +45,7 @@ activity.presence_info = { }; (function test_presence_list_full_update() { - var users = activity._update_users(); + var users = activity.update_users(); assert.deepEqual(users, [ { name: 'Fred Flintstone', email: 'fred@zulip.com', @@ -86,7 +86,7 @@ activity.presence_info = { }; activity.presence_info['alice@zulip.com'] = users['alice@zulip.com']; - users = activity._update_users(users); + users = activity.update_users(users); assert.deepEqual(users, [ { name: 'Alice Smith', email: 'alice@zulip.com', @@ -105,7 +105,7 @@ activity.presence_info = { 'mark@zulip.com': {status: 'active'} }; activity.presence_info['mark@zulip.com'] = users['mark@zulip.com']; - users = activity._update_users(users); + users = activity.update_users(users); assert.deepEqual(users, [ { name: 'Marky Mark', email: 'mark@zulip.com', diff --git a/static/js/activity.js b/static/js/activity.js index 3a16e89678..89e0401f83 100644 --- a/static/js/activity.js +++ b/static/js/activity.js @@ -215,7 +215,7 @@ function filter_and_sort(users) { } exports._filter_and_sort = filter_and_sort; -function actually_update_users(user_list) { +exports.update_users = function (user_list) { if (page_params.domain === 'mit.edu') { return; // MIT realm doesn't have a presence list } @@ -268,20 +268,10 @@ function actually_update_users(user_list) { // Return updated users: useful for testing user performance fix return user_info; -} -exports._update_users = actually_update_users; - -// The function actually_update_users() can be pretty expensive for realms with lots -// of users. Not only is there more work to do in terms of rendering the user list, but -// we also get more updates. Large realms have reported lags while typing in the compose -// box, and there's strong evidence that this is caused by user list updates. This isn't a -// perfect solution, but it should remove some pain, and there's no real harm in waiting five -// seconds to update user activity. -var update_users = _.throttle(actually_update_users, 5000); - +}; function actually_update_users_for_search() { - actually_update_users(); + exports.update_users(); resize.resize_page_components(); } @@ -385,7 +375,7 @@ function focus_ping() { exports.presence_info[this_email] = status_from_timestamp(data.server_timestamp, presence); } }); - update_users(); + exports.update_users(); exports.update_huddles(); } }); @@ -431,7 +421,7 @@ exports.set_user_statuses = function (users, server_time) { updated_users[email] = status; }); - update_users(updated_users); + exports.update_users(updated_users); exports.update_huddles(); };