fixes #1416; more consistent metatag parser code
This commit is contained in:
@@ -193,13 +193,17 @@ class PostQueryBuilder
|
|||||||
has_constraints!
|
has_constraints!
|
||||||
end
|
end
|
||||||
|
|
||||||
if q[:commenter_id]
|
if q[:commenter_ids]
|
||||||
relation = relation.where(:id => Comment.where("creator_id = ?", q[:commenter_id]).select("post_id").uniq)
|
q[:commenter_ids].each do |commenter_id|
|
||||||
|
relation = relation.where(:id => Comment.where("creator_id = ?", commenter_id).select("post_id").uniq)
|
||||||
|
end
|
||||||
has_constraints!
|
has_constraints!
|
||||||
end
|
end
|
||||||
|
|
||||||
if q[:noter_id]
|
if q[:noter_ids]
|
||||||
relation = relation.where(:id => Note.where("creator_id = ?", q[:noter_id]).select("post_id").uniq)
|
q[:noter_ids].each do |noter_id|
|
||||||
|
relation = relation.where(:id => Note.where("creator_id = ?", noter_id).select("post_id").uniq)
|
||||||
|
end
|
||||||
has_constraints!
|
has_constraints!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -302,8 +302,8 @@ class Tag < ActiveRecord::Base
|
|||||||
q[:uploader_id_neg] << user_id unless user_id.blank?
|
q[:uploader_id_neg] << user_id unless user_id.blank?
|
||||||
|
|
||||||
when "user"
|
when "user"
|
||||||
q[:uploader_id] = User.name_to_id($2)
|
user_id = User.name_to_id($2)
|
||||||
q[:uploader_id] = -1 if q[:uploader_id].blank?
|
q[:uploader_id] = user_id unless user_id.blank?
|
||||||
|
|
||||||
when "-approver"
|
when "-approver"
|
||||||
q[:approver_id_neg] ||= []
|
q[:approver_id_neg] ||= []
|
||||||
@@ -311,16 +311,18 @@ class Tag < ActiveRecord::Base
|
|||||||
q[:approver_id_neg] << user_id unless user_id.blank?
|
q[:approver_id_neg] << user_id unless user_id.blank?
|
||||||
|
|
||||||
when "approver"
|
when "approver"
|
||||||
q[:approver_id] = User.name_to_id($2)
|
user_id = User.name_to_id($2)
|
||||||
q[:approver_id] = -1 if q[:approver_id].blank?
|
q[:approver_id] = user_id unless user_id.blank?
|
||||||
|
|
||||||
when "commenter", "comm"
|
when "commenter", "comm"
|
||||||
q[:commenter_id] = User.name_to_id($2)
|
q[:commenter_ids] ||= []
|
||||||
q[:commenter_id] = -1 if q[:commenter_id].blank?
|
user_id = User.name_to_id($2)
|
||||||
|
q[:commenter_ids] << user_id unless user_id.blank?
|
||||||
|
|
||||||
when "noter"
|
when "noter"
|
||||||
q[:noter_id] = User.name_to_id($2)
|
q[:noter_ids] ||= []
|
||||||
q[:noter_id] = -1 if q[:noter_id].blank?
|
user_id = User.name_to_id($2)
|
||||||
|
q[:noter_ids] << user_id unless user_id.blank?
|
||||||
|
|
||||||
when "-pool"
|
when "-pool"
|
||||||
q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"
|
q[:tags][:exclude] << "pool:#{Pool.name_to_id($2)}"
|
||||||
|
|||||||
Reference in New Issue
Block a user