diff --git a/app/logical/post_query_builder.rb b/app/logical/post_query_builder.rb index 27f8b9e02..33f14007b 100644 --- a/app/logical/post_query_builder.rb +++ b/app/logical/post_query_builder.rb @@ -193,13 +193,17 @@ class PostQueryBuilder has_constraints! end - if q[:commenter_id] - relation = relation.where(:id => Comment.where("creator_id = ?", q[:commenter_id]).select("post_id").uniq) + if q[:commenter_ids] + q[:commenter_ids].each do |commenter_id| + relation = relation.where(:id => Comment.where("creator_id = ?", commenter_id).select("post_id").uniq) + end has_constraints! end - if q[:noter_id] - relation = relation.where(:id => Note.where("creator_id = ?", q[:noter_id]).select("post_id").uniq) + if q[:noter_ids] + q[:noter_ids].each do |noter_id| + relation = relation.where(:id => Note.where("creator_id = ?", noter_id).select("post_id").uniq) + end has_constraints! end diff --git a/app/models/tag.rb b/app/models/tag.rb index a5b3f18c4..14de90831 100644 --- a/app/models/tag.rb +++ b/app/models/tag.rb @@ -302,8 +302,8 @@ class Tag < ActiveRecord::Base q[:uploader_id_neg] << user_id unless user_id.blank? when "user" - q[:uploader_id] = User.name_to_id($2) - q[:uploader_id] = -1 if q[:uploader_id].blank? + user_id = User.name_to_id($2) + q[:uploader_id] = user_id unless user_id.blank? when "-approver" q[:approver_id_neg] ||= [] @@ -311,16 +311,18 @@ class Tag < ActiveRecord::Base q[:approver_id_neg] << user_id unless user_id.blank? when "approver" - q[:approver_id] = User.name_to_id($2) - q[:approver_id] = -1 if q[:approver_id].blank? + user_id = User.name_to_id($2) + q[:approver_id] = user_id unless user_id.blank? when "commenter", "comm" - q[:commenter_id] = User.name_to_id($2) - q[:commenter_id] = -1 if q[:commenter_id].blank? + q[:commenter_ids] ||= [] + user_id = User.name_to_id($2) + q[:commenter_ids] << user_id unless user_id.blank? when "noter" - q[:noter_id] = User.name_to_id($2) - q[:noter_id] = -1 if q[:noter_id].blank? + q[:noter_ids] ||= [] + user_id = User.name_to_id($2) + q[:noter_ids] << user_id unless user_id.blank? when "-pool" q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"