mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-22 17:35:40 +01:00
Add supported operator and properties for search
This commit is contained in:
parent
828eebad48
commit
04ad5e67d0
1 changed files with 19 additions and 0 deletions
|
@ -12,6 +12,23 @@ class SearchQueryTransformer < Parslet::Transform
|
|||
in
|
||||
).freeze
|
||||
|
||||
SUPPORTED_OPERATOR = %w(
|
||||
+
|
||||
-
|
||||
).freeze
|
||||
|
||||
SUPPORTED_PROPERTIES = %w(
|
||||
image
|
||||
video
|
||||
audio
|
||||
media
|
||||
poll
|
||||
link
|
||||
embed
|
||||
sensitive
|
||||
reply
|
||||
).freeze
|
||||
|
||||
class Query
|
||||
def initialize(clauses, options = {})
|
||||
raise ArgumentError if options[:current_account].nil?
|
||||
|
@ -152,6 +169,8 @@ class SearchQueryTransformer < Parslet::Transform
|
|||
|
||||
case prefix
|
||||
when 'has', 'is'
|
||||
raise "Unknown properties: #{term}" unless SUPPORTED_PROPERTIES.include?(term)
|
||||
|
||||
@filter = :properties
|
||||
@type = :term
|
||||
@term = term
|
||||
|
|
Loading…
Reference in a new issue