Merge pull request #3003 from evazion/feat-noter-any-metatag
Add noter:<any|none>, commenter:<any|none> metatags
This commit is contained in:
@@ -238,14 +238,26 @@ class PostQueryBuilder
|
||||
|
||||
if q[:commenter_ids]
|
||||
q[:commenter_ids].each do |commenter_id|
|
||||
relation = relation.where("posts.id IN (?)", Comment.unscoped.where("creator_id = ?", commenter_id).select("post_id").uniq)
|
||||
if commenter_id == "any"
|
||||
relation = relation.where("posts.last_commented_at is not null")
|
||||
elsif commenter_id == "none"
|
||||
relation = relation.where("posts.last_commented_at is null")
|
||||
else
|
||||
relation = relation.where("posts.id": Comment.unscoped.where(creator_id: commenter_id).select(:post_id).distinct)
|
||||
end
|
||||
end
|
||||
has_constraints!
|
||||
end
|
||||
|
||||
if q[:noter_ids]
|
||||
q[:noter_ids].each do |noter_id|
|
||||
relation = relation.where("posts.id IN (?)", Note.unscoped.where("creator_id = ?", noter_id).select("post_id").uniq)
|
||||
if noter_id == "any"
|
||||
relation = relation.where("posts.last_noted_at is not null")
|
||||
elsif noter_id == "none"
|
||||
relation = relation.where("posts.last_noted_at is null")
|
||||
else
|
||||
relation = relation.where("posts.id": Note.unscoped.where(creator_id: noter_id).select("post_id").distinct)
|
||||
end
|
||||
end
|
||||
has_constraints!
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user