mirror of https://github.com/zulip/zulip.git
typeahead: Remove default value for triage.
"get_item"'s default value is not type-safe as we require its return value to always be a "string". Note that since the mobile app does not rely on this function directly, it is sufficient to only refactor the web app for this transition. Signed-off-by: Zixuan James Li <p359101898@gmail.com>
This commit is contained in:
parent
ec58b6790d
commit
45fdfcd6d4
|
@ -112,7 +112,7 @@ function get_stream_suggestions(last, operators) {
|
|||
|
||||
streams = streams.filter((stream) => stream_matches_query(stream, query));
|
||||
|
||||
streams = typeahead_helper.sorter(query, streams);
|
||||
streams = typeahead_helper.sorter(query, streams, (x) => x);
|
||||
|
||||
const regex = typeahead_helper.build_highlight_regex(query);
|
||||
const highlight_query = typeahead_helper.highlight_with_escaping_and_regex;
|
||||
|
|
|
@ -287,7 +287,7 @@ function retain_unique_language_aliases(matches) {
|
|||
}
|
||||
|
||||
export function sort_languages(matches, query) {
|
||||
const results = typeahead.triage(query, matches);
|
||||
const results = typeahead.triage(query, matches, (x) => x);
|
||||
|
||||
// Languages that start with the query
|
||||
results.matches = results.matches.sort(compare_by_popularity);
|
||||
|
|
|
@ -91,7 +91,7 @@ export function get_emoji_matcher(query) {
|
|||
};
|
||||
}
|
||||
|
||||
export function triage(query, objs, get_item = (x) => x) {
|
||||
export function triage(query, objs, get_item) {
|
||||
/*
|
||||
We split objs into four groups:
|
||||
|
||||
|
|
Loading…
Reference in New Issue