mirror of https://github.com/zulip/zulip.git
search.js: Clean up local variables a bit
(imported from commit 5094017271994a0aa50ec8cccc633360b46e90dc)
This commit is contained in:
parent
616ed68440
commit
cd76add2de
|
@ -161,27 +161,28 @@ exports.initialize = function () {
|
||||||
$( "#search_query" ).typeahead({
|
$( "#search_query" ).typeahead({
|
||||||
source: function (query, process) {
|
source: function (query, process) {
|
||||||
var result = [];
|
var result = [];
|
||||||
|
var suggestion;
|
||||||
|
var suggestions;
|
||||||
|
|
||||||
// Add an entry for narrow by operators.
|
// Add an entry for narrow by operators.
|
||||||
var operators = narrow.parse(query);
|
var operators = narrow.parse(query);
|
||||||
if (operators.length !== 0) {
|
if (operators.length !== 0) {
|
||||||
var suggestion = get_suggestion_based_on_query(query, operators);
|
suggestion = get_suggestion_based_on_query(query, operators);
|
||||||
result = [suggestion];
|
result = [suggestion];
|
||||||
} else {
|
} else {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
var stream_suggestions = get_stream_suggestions(query, 4);
|
suggestions = get_stream_suggestions(query, 4);
|
||||||
result = result.concat(stream_suggestions);
|
result = result.concat(suggestions);
|
||||||
|
|
||||||
var people = page_params.people_list;
|
var people = page_params.people_list;
|
||||||
var person_suggestions;
|
|
||||||
|
|
||||||
person_suggestions = get_person_suggestions(people, query, 'Narrow to private messages with', 'pm-with', 4);
|
suggestions = get_person_suggestions(people, query, 'Narrow to private messages with', 'pm-with', 4);
|
||||||
result = result.concat(person_suggestions);
|
result = result.concat(suggestions);
|
||||||
|
|
||||||
person_suggestions = get_person_suggestions(people, query, 'Narrow to messages sent by', 'sender', 4);
|
suggestions = get_person_suggestions(people, query, 'Narrow to messages sent by', 'sender', 4);
|
||||||
result = result.concat(person_suggestions);
|
result = result.concat(suggestions);
|
||||||
|
|
||||||
// We can't send typeahead objects, only strings.
|
// We can't send typeahead objects, only strings.
|
||||||
search_object = {};
|
search_object = {};
|
||||||
|
|
Loading…
Reference in New Issue