adds commenter: and noter: metatags

This commit is contained in:
Toks
2013-03-29 20:18:03 -04:00
parent 85a5fcc658
commit 28f04eb1b2
2 changed files with 19 additions and 1 deletions

View File

@@ -189,6 +189,16 @@ class PostQueryBuilder
has_constraints!
end
if q[:commenter_id]
relation = relation.where(:id => Comment.where("creator_id = ?", q[:commenter_id]).select("post_id").uniq)
has_constraints!
end
if q[:noter_id]
relation = relation.where(:id => Note.where("creator_id = ?", q[:noter_id]).select("post_id").uniq)
has_constraints!
end
if q[:parent_id]
relation = relation.where("(posts.id = ? or posts.parent_id = ?)", q[:parent_id], q[:parent_id])
has_constraints!

View File

@@ -1,5 +1,5 @@
class Tag < ActiveRecord::Base
METATAGS = "-user|user|-approver|approver|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|pixiv"
METATAGS = "-user|user|-approver|approver|commenter|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|width|height|mpixels|score|filesize|source|id|date|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|pixiv"
attr_accessible :category
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
@@ -280,6 +280,14 @@ class Tag < ActiveRecord::Base
q[:approver_id] = User.name_to_id($2)
q[:approver_id] = -1 if q[:approver_id].nil?
when "commenter"
q[:commenter_id] = User.name_to_id($2)
q[:commenter_id] = -1 if q[:commenter_id].nil?
when "noter"
q[:noter_id] = User.name_to_id($2)
q[:noter_id] = -1 if q[:noter_id].nil?
when "-pool"
q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"