Fix #5194: AND/OR no longer trigger autocomplete.

Also change the /autocomplete.json API to no longer strip '-' and '~'
from the start of the tag. This may be a breaking change if third-party
scripts relied on this behavior.
This commit is contained in:
evazion
2022-08-25 20:41:42 -05:00
parent 9eb31c8018
commit 115085006e
2 changed files with 11 additions and 11 deletions

View File

@@ -79,17 +79,12 @@ class AutocompleteService
#
# @return [Array<Hash>] the autocomplete results
def autocomplete_tag_query
if parsed_query.tag_names.one?
tag = parsed_query.tag_names.first
autocomplete_tag(tag)
elsif parsed_query.wildcards.one?
wildcard = parsed_query.wildcards.first
autocomplete_tag(wildcard.name)
elsif parsed_query.metatags.one?
if parsed_query.metatags.one?
metatag = parsed_query.metatags.first
autocomplete_metatag(metatag.name, metatag.value)
else
[]
tag = Tag.normalize_name(query)
autocomplete_tag(tag)
end
end
@@ -351,7 +346,7 @@ class AutocompleteService
end
def parsed_query
PostQuery.new(query.delete_prefix("-").delete_prefix("~"))
PostQuery.new(query)
end
memoize :autocomplete_results, :parsed_query