posts: refactor hardcoded ratings.
Refactor ratings to not be hardcoded in various places. Make it so all ratings are defined in Post::RATINGS. Also make it so that you can search multiple ratings at once with `rating:q,e`.
This commit is contained in:
@@ -16,7 +16,7 @@ class AutocompleteService
|
||||
status: %w[any] + POST_STATUSES,
|
||||
child: %w[any none] + POST_STATUSES,
|
||||
parent: %w[any none] + POST_STATUSES,
|
||||
rating: %w[safe questionable explicit],
|
||||
rating: Post::RATINGS.values.map(&:downcase),
|
||||
embedded: %w[true false],
|
||||
filetype: %w[jpg png gif swf zip webm mp4],
|
||||
commentary: %w[true false translated untranslated],
|
||||
|
||||
@@ -128,7 +128,7 @@ class PostQueryBuilder
|
||||
when "child"
|
||||
relation.child_matches(value)
|
||||
when "rating"
|
||||
relation.where(rating: value.first.downcase)
|
||||
relation.rating_matches(value)
|
||||
when "embedded"
|
||||
relation.embedded_matches(value)
|
||||
when "source"
|
||||
|
||||
Reference in New Issue
Block a user