This commit is contained in:
Toks
2013-04-13 13:42:23 -04:00
parent 5843b3037f
commit c9e98a4619
2 changed files with 11 additions and 4 deletions

View File

@@ -202,8 +202,12 @@ class PostQueryBuilder
has_constraints!
end
if q[:parent_id]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent_id], q[:parent_id])
if q[:parent] == "none"
relation = relation.where("posts.parent_id IS NULL")
elsif q[:parent_neg] == "none" || q[:parent] == "any"
relation = relation.where("posts.parent_id IS NOT NULL")
elsif q[:parent]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent], q[:parent])
has_constraints!
end

View File

@@ -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|date|order|-status|status|tagcount|gentags|arttags|chartags|copytags|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|id|date|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"
@@ -366,7 +366,10 @@ class Tag < ActiveRecord::Base
q[:copyright_tag_count] = parse_helper($2)
when "parent"
q[:parent_id] = $2.to_i
q[:parent] = $2.downcase
when "-parent"
q[:parent_neg] = $2.downcase
when "order"
q[:order] = $2.downcase