diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index a3844fc5e..fc71e5a35 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -233,6 +233,13 @@ class PostQueryBuilder has_constraints! end + if q[:artcomm_ids] + q[:artcomm_ids].each do |artcomm_id| + relation = relation.where(:id => ArtistCommentaryVersion.where("updater_id = ?", artcomm_id).select("post_id").uniq) + end + has_constraints! + end + if q[:post_id_negated] relation = relation.where("posts.id <> ?", q[:post_id_negated]) end diff --git a/app/models/tag.rb b/app/models/tag.rb index 9b1117f16..a21b85c0c 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -1,5 +1,5 @@ class Tag < ActiveRecord::Base - METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|ordfav|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|child|pixiv_id|pixiv" + METATAGS = "-user|user|-approver|approver|commenter|comm|noter|artcomm|-pool|pool|-fav|fav|ordfav|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|child|pixiv_id|pixiv" attr_accessible :category, :as => [:moderator, :janitor, :contributor, :gold, :member, :anonymous, :default, :builder, :admin] attr_accessible :is_locked, :as => [:moderator, :janitor, :admin] has_one :wiki_page, :foreign_key => "title", :primary_key => "name" @@ -375,6 +375,11 @@ class Tag < ActiveRecord::Base user_id = User.name_to_id($2) q[:noter_ids] << user_id unless user_id.blank? + when "artcomm" + q[:artcomm_ids] ||= [] + user_id = User.name_to_id($2) + q[:artcomm_ids] << user_id unless user_id.blank? + when "-pool" q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"