autocomplete: fix empty autocomplete calls when toggling related tags.

This happens because toggling a related tag updates the tag box, which
triggers autocomplete, which can't find a tag because the cursor isn't
in the tag box, so it ends up making an autocomplete call for the empty
string.
This commit is contained in:
evazion
2021-02-25 15:09:35 -06:00
parent cf62e13394
commit 0eea654a48

View File

@@ -199,6 +199,10 @@ Autocomplete.render_item = function(list, item) {
};
Autocomplete.autocomplete_source = function(query, type) {
if (query === "") {
return [];
}
return $.getJSON("/autocomplete.json", {
"search[query]": query,
"search[type]": type,