autocomplete: fix completion of ai: metatag.
Fix it so we don't show the `ai:` prefix in front of results in the autocomplete menu when completing the `ai: metatag.
This commit is contained in:
@@ -32,16 +32,18 @@ class AutocompleteComponent < ApplicationComponent
|
||||
end
|
||||
|
||||
def highlight_result(result)
|
||||
if result.type == "tag-word"
|
||||
highlight_matching_words(result.value, query)
|
||||
elsif result.type == "mention"
|
||||
highlight_wildcard_match(result.label, query + "*")
|
||||
elsif metatag.present? && metatag.value.include?("*")
|
||||
if metatag.present? && metatag.value.include?("*")
|
||||
highlight_wildcard_match(result.label, metatag.value)
|
||||
elsif metatag.present? && metatag.name.in?(%w[pool favgroup])
|
||||
highlight_wildcard_match(result.label, "*" + metatag.value + "*")
|
||||
elsif metatag.present? && metatag.name.in?(%w[ai unaliased])
|
||||
highlight_matching_words(result.label, metatag.value)
|
||||
elsif metatag.present?
|
||||
highlight_wildcard_match(result.label, metatag.value + "*")
|
||||
elsif result.type == "tag-word"
|
||||
highlight_matching_words(result.value, query)
|
||||
elsif result.type == "mention"
|
||||
highlight_wildcard_match(result.label, query + "*")
|
||||
elsif query.include?("*")
|
||||
highlight_wildcard_match(result.value, query)
|
||||
else
|
||||
|
||||
@@ -256,7 +256,7 @@ class Tag < ApplicationRecord
|
||||
def split_words(name)
|
||||
return [name] if !parsable_into_words?(name)
|
||||
|
||||
name.split(WORD_DELIMITER_REGEX).compact_blank
|
||||
name.split(WORD_DELIMITER_REGEX).reject(&:empty?)
|
||||
end
|
||||
|
||||
# Parse the tag into plain words, removing punctuation and delimiters.
|
||||
|
||||
Reference in New Issue
Block a user