diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index 8fff27df7..f3a67b588 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -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! diff --git a/app/models/tag.rb b/app/models/tag.rb index eb8698e87..4856e143c 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -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)}"