Skip to content

armgit / zulip

Public Imported from GitHub
0

Zulip server and web application. Open-source team chat that helps teams stay productive and focused.

people: Don't refetch user when we already have it.

evykassireraf8263fb871a
diff --git a/web/src/people.ts b/web/src/people.ts
index 8062e73fc5a..dbb3f4539dd 100644
--- a/web/src/people.ts
+++ b/web/src/people.ts
@@ -1234,17 +1234,11 @@ export function filter_people_by_search_terms(
// Loop through users and populate filtered_users only
// if they include search_terms
for (const user of users) {
- const person = get_by_email(user.email);
- // Get person object (and ignore errors)
- if (!person?.full_name) {
- continue;
- }
-
// Return user emails that include search terms
const match = matchers.some((matcher) => matcher(user));
if (match) {
- filtered_users.set(person.user_id, true);
+ filtered_users.set(user.user_id, true);
}
}
diff --git a/web/tests/people.test.js b/web/tests/people.test.js
index c54042719c4..c625618dcd8 100644
--- a/web/tests/people.test.js
+++ b/web/tests/people.test.js
@@ -758,13 +758,6 @@ test_people("filtered_users", () => {
filtered_people = people.filter_people_by_search_terms(users, ["ëm"]);
assert.equal(filtered_people.size, 1);
assert.ok(filtered_people.has(noah.user_id));
-
- // Test filtering with undefined user
- users.push(invalid_user);
-
- filtered_people = people.filter_people_by_search_terms(users, ["ltorv"]);
- assert.equal(filtered_people.size, 1);
- assert.ok(filtered_people.has(linus.user_id));
});
test_people("multi_user_methods", () => {