people: Split search terms inside the search function.

This helps other views calling this function to not do a separate
split of the terms.
This commit is contained in:
Aman Agrawal
2024-05-16 05:41:44 +00:00
committed by Tim Abbott
parent 2a8174baa3
commit b2dc6f4039
3 changed files with 12 additions and 12 deletions

View File

@@ -1224,7 +1224,10 @@ export function build_person_matcher(query: string): (user: User) => boolean {
};
}
export function filter_people_by_search_terms(users: User[], search_terms: string[]): Set<number> {
export function filter_people_by_search_terms(users: User[], search_string: string): Set<number> {
let search_terms = search_string.toLowerCase().split(/[,|]+/);
search_terms = search_terms.map((s) => s.trim());
const filtered_users = new Set<number>();
// Build our matchers outside the loop to avoid some