mirror of
https://github.com/zulip/zulip.git
synced 2026-07-12 21:04:41 +08:00
search.js: Simplify get_person_suggestions
(imported from commit 44f22923a73633c5693a99ae9ce788f10cd5f505)
This commit is contained in:
parent
c515ad4cbb
commit
98d2c5361f
@ -145,25 +145,14 @@ function get_person_suggestions(all_people, query, prefix, operator, max_num) {
|
||||
return person_matches_query(person, query);
|
||||
});
|
||||
|
||||
people.sort(typeahead_helper.compare_by_pms);
|
||||
people = people.slice(0, max_num);
|
||||
|
||||
var objs = $.map(people, function (person) {
|
||||
return {query: person};
|
||||
});
|
||||
|
||||
|
||||
objs.sort(function (x, y) {
|
||||
return typeahead_helper.compare_by_pms(get_query(x), get_query(y));
|
||||
});
|
||||
|
||||
objs = objs.slice(0, max_num);
|
||||
|
||||
$.each(objs, function (idx, obj) {
|
||||
var person;
|
||||
var name;
|
||||
|
||||
person = obj.query;
|
||||
name = highlight_person(query, person);
|
||||
obj.description = prefix + ' ' + name;
|
||||
obj.search_string = operator + ':' + obj.query.email;
|
||||
var name = highlight_person(query, person);
|
||||
var description = prefix + ' ' + name;
|
||||
var search_string = operator + ':' + person.email;
|
||||
return {description: description, search_string: search_string};
|
||||
});
|
||||
|
||||
return objs;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user