diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 6f0e64cb96..890f0357c6 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -62,6 +62,9 @@ initialize(); assert.equal(_.size(realm_persons), 1); assert.equal(realm_persons[0].full_name, 'Isaac Newton'); + var human_user_ids = people.get_realm_human_user_ids(); + assert.deepEqual(human_user_ids, [isaac.user_id]); + // Now deactivate isaac people.deactivate(isaac); person = people.realm_get(email); diff --git a/static/js/activity.js b/static/js/activity.js index f0e3137cb8..a7c42403e8 100644 --- a/static/js/activity.js +++ b/static/js/activity.js @@ -350,9 +350,7 @@ exports.build_user_sidebar = function () { if (exports.get_filter_text()) { // If there's a filter, select from all users, not just those // recently active. - user_ids = filter_and_sort(people.get_realm_persons().map(function (person) { - return person.user_id; - })); + user_ids = filter_and_sort(people.get_realm_human_user_ids()); } else { user_ids = filter_and_sort(presence.get_user_ids()); } diff --git a/static/js/people.js b/static/js/people.js index bcc3ca9b77..c26e7ceb4d 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -538,6 +538,12 @@ exports.get_realm_persons = function () { return realm_people_dict.values(); }; +exports.get_realm_human_user_ids = function () { + // This returns user_ids for all non-bot users + // in the realm. + return realm_people_dict.keys(); +}; + exports.is_cross_realm_email = function (email) { var person = people.get_by_email(email); if (!person) {