Add people.get_realm_user_ids().

This saves us from doing an unnecessary map() in
activity.js.
This commit is contained in:
Steve Howell 2017-10-07 11:10:10 -07:00 committed by Tim Abbott
parent 943eefb7c0
commit 6888255153
3 changed files with 10 additions and 3 deletions

View File

@ -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);

View File

@ -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());
}

View File

@ -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) {