posts: add is: and has: metatags.

Add the following metatags:

* is:parent
* is:child
* is:safe
* is:questionable
* is:explicit
* is:sfw (same as -rating:q,e)
* is:nsfw (same as rating:q,e)
* is:active
* is:deleted
* is:pending
* is:flagged
* is:appealed
* is:banned
* is:modqueue
* is:unmoderated
* is:jpg
* is:png
* is:gif
* is:mp4
* is:webm
* is:swf
* is:zip
* has:parent
* has:children
* has:source
* has:appeals
* has:flags
* has:replacements
* has:comments
* has:commentary
* has:notes
* has:pools

All of these searches were already possible with other metatags, but these might be more convenient.
This commit is contained in:
evazion
2022-05-18 11:44:35 -05:00
parent 141044d352
commit 181639368c
5 changed files with 150 additions and 3 deletions

View File

@@ -38,7 +38,7 @@ class PostQueryBuilder
ordpool note comment commentary id rating source status filetype
disapproved parent child search embedded md5 width height mpixels ratio
score upvotes downvotes favcount filesize date age order limit tagcount pixiv_id pixiv
unaliased exif duration random
unaliased exif duration random is has
] + COUNT_METATAGS + COUNT_METATAG_SYNONYMS + CATEGORY_COUNT_METATAGS
ORDER_METATAGS = %w[
@@ -121,6 +121,10 @@ class PostQueryBuilder
relation.attribute_matches(value, :tag_count)
when "duration"
relation.attribute_matches(value, "media_assets.duration", :float).joins(:media_asset)
when "is"
relation.is_matches(value, current_user)
when "has"
relation.has_matches(value)
when "status"
relation.status_matches(value, current_user)
when "parent"