Fix #3715: Provide any/none modifiers for pixiv: metatag

This commit is contained in:
evazion
2018-08-22 00:25:38 -05:00
parent 8cc393183e
commit 9a0f37e359
3 changed files with 29 additions and 5 deletions

View File

@@ -122,7 +122,6 @@ class PostQueryBuilder
relation = add_range_relation(q["#{category}_tag_count".to_sym], "posts.tag_count_#{category}", relation)
end
relation = add_range_relation(q[:post_tag_count], "posts.tag_count", relation)
relation = add_range_relation(q[:pixiv_id], "posts.pixiv_id", relation)
if q[:md5]
relation = relation.where(["posts.md5 IN (?)", q[:md5]])
@@ -327,6 +326,16 @@ class PostQueryBuilder
relation = relation.where("posts.has_children = TRUE")
end
if q[:pixiv_id]
if q[:pixiv_id] == "any"
relation = relation.where("posts.pixiv_id IS NOT NULL")
elsif q[:pixiv_id] == "none"
relation = relation.where("posts.pixiv_id IS NULL")
else
relation = add_range_relation(q[:pixiv_id], "posts.pixiv_id", relation)
end
end
if q[:rating] =~ /^q/
relation = relation.where("posts.rating = 'q'")
elsif q[:rating] =~ /^s/

View File

@@ -763,7 +763,11 @@ class Tag < ApplicationRecord
q[:filetype_neg] = g2.downcase
when "pixiv_id", "pixiv"
q[:pixiv_id] = parse_helper(g2)
if g2.downcase == "any" || g2.downcase == "none"
q[:pixiv_id] = g2.downcase
else
q[:pixiv_id] = parse_helper(g2)
end
when "upvote"
if CurrentUser.user.is_moderator?