mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 14:08:23 +00:00
Extract search.get_suggestions().
(This makes testing a bit easier, plus it dedents some code.) (imported from commit 80532990608cc51ca55d3354bd300734afd7942e)
This commit is contained in:
@@ -423,9 +423,9 @@ function get_special_filter_suggestions(query, operators) {
|
|||||||
return suggestions;
|
return suggestions;
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.initialize = function () {
|
// We make this a public method to facilitate testing, but it's only
|
||||||
$( "#search_query" ).typeahead({
|
// used internally. This becomes the "source" callback for typeahead.
|
||||||
source: function (query, process) {
|
exports.get_suggestions = function (query) {
|
||||||
var result = [];
|
var result = [];
|
||||||
var suggestion;
|
var suggestion;
|
||||||
var suggestions;
|
var suggestions;
|
||||||
@@ -471,7 +471,11 @@ exports.initialize = function () {
|
|||||||
return $.map(final_result, function (obj) {
|
return $.map(final_result, function (obj) {
|
||||||
return obj.search_string;
|
return obj.search_string;
|
||||||
});
|
});
|
||||||
},
|
};
|
||||||
|
|
||||||
|
exports.initialize = function () {
|
||||||
|
$( "#search_query" ).typeahead({
|
||||||
|
source: exports.get_suggestions,
|
||||||
items: 30,
|
items: 30,
|
||||||
helpOnEmptyStrings: true,
|
helpOnEmptyStrings: true,
|
||||||
naturalSearch: true,
|
naturalSearch: true,
|
||||||
|
|||||||
Reference in New Issue
Block a user