Add domain search prefix

This commit is contained in:
KMY 2023-08-30 07:53:51 +09:00
parent 05a022448b
commit 7c4a4b905b
2 changed files with 11 additions and 0 deletions

View file

@ -103,6 +103,10 @@ class SearchQueryTransformer < Parslet::Transform
@filter = :account_id
@type = :term
@term = account_id_from_term(term)
when 'domain'
@filter = :domain
@type = :term
@term = domain_from_term(term)
when 'before'
@filter = :created_at
@type = :range
@ -137,6 +141,12 @@ class SearchQueryTransformer < Parslet::Transform
# an ID that does not exist
account&.id || -1
end
def domain_from_term(term)
return '' if %w(local me).include?(term)
term
end
end
rule(clause: subtree(:clause)) do