Add domain search prefix
This commit is contained in:
parent
05a022448b
commit
7c4a4b905b
2 changed files with 11 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue