mirror of
https://github.com/zulip/zulip.git
synced 2025-11-07 07:23:22 +00:00
people: Add common function for getting active human users.
This commit is contained in:
committed by
Tim Abbott
parent
fd71f7282d
commit
16357fc84a
@@ -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', () => {
|
||||
|
||||
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user