@@ -170,6 +170,20 @@ class PostQueryBuilder
|
||||
end
|
||||
end
|
||||
|
||||
if q[:source_neg]
|
||||
if q[:source_neg] == "none%"
|
||||
relation = relation.where("(posts.source != '' AND posts.source IS NOT NULL)")
|
||||
elsif q[:source_neg] == "http%"
|
||||
relation = relation.where("(posts.source not like ?)", "http%")
|
||||
elsif q[:source_neg] =~ /^%\.?pixiv(?:\.net(?:\/img)?)?(?:%\/|(?=%$))(.+)$/
|
||||
relation = relation.where("SourcePattern(posts.source) NOT LIKE ? ESCAPE E'\\\\'", "pixiv/" + $1)
|
||||
has_constraints!
|
||||
else
|
||||
relation = relation.where("SourcePattern(posts.source) NOT LIKE SourcePattern(?) ESCAPE E'\\\\'", q[:source_neg])
|
||||
has_constraints!
|
||||
end
|
||||
end
|
||||
|
||||
if q[:subscriptions]
|
||||
relation = add_tag_subscription_relation(q[:subscriptions], relation)
|
||||
has_constraints!
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class Tag < ActiveRecord::Base
|
||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|id|-id|date|age|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|pixiv_id|pixiv"
|
||||
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|-source|id|-id|date|age|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|pixiv_id|pixiv"
|
||||
attr_accessible :category
|
||||
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
|
||||
|
||||
@@ -399,6 +399,9 @@ class Tag < ActiveRecord::Base
|
||||
when "source"
|
||||
q[:source] = ($2.to_escaped_for_sql_like + "%").gsub(/%+/, '%')
|
||||
|
||||
when "-source"
|
||||
q[:source_neg] = ($2.to_escaped_for_sql_like + "%").gsub(/%+/, '%')
|
||||
|
||||
when "date"
|
||||
q[:date] = parse_helper($2, :date)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user