diff --git a/frontend_tests/node_tests/people.js b/frontend_tests/node_tests/people.js index 2f7d168fbb..2d89c75bee 100644 --- a/frontend_tests/node_tests/people.js +++ b/frontend_tests/node_tests/people.js @@ -109,6 +109,12 @@ run_test('basics', () => { assert.equal(people.is_my_user_id(me.user_id), true); assert.equal(people.is_my_user_id(isaac.user_id), false); assert.equal(people.is_my_user_id(undefined), false); + + // Reactivating issac + people.add_in_realm(isaac); + var active_human_persons = people.get_active_human_persons(); + assert.equal(active_human_persons.length, 1); + assert.deepEqual(active_human_persons, [isaac]); }); run_test('pm_lookup_key', () => { diff --git a/static/js/people.js b/static/js/people.js index 9dce575bd0..1729e87f58 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -617,6 +617,13 @@ exports.get_realm_persons = function () { return active_user_dict.values(); }; +exports.get_active_human_persons = function () { + var human_persons = exports.get_realm_persons().filter(function (person) { + return !person.is_bot; + }); + return human_persons; +}; + exports.get_active_user_ids = function () { // This includes active users and active bots. return active_user_dict.keys();