pools: stop using the pool_string field (#4160).
Stop using the pool_string field internally, but keep maintaining it until we can drop it later. * Stop using the pool_string for `pool:<name>` metatag searches. * Stop using the pool_string in the `Post#pools` method. This is used to get the list of pools on post show pages.
This commit is contained in:
@@ -211,10 +211,38 @@ class PostQueryBuilder
|
||||
end
|
||||
end
|
||||
|
||||
if q[:pool] == "none"
|
||||
relation = relation.where("posts.pool_string = ''")
|
||||
elsif q[:pool] == "any"
|
||||
relation = relation.where("posts.pool_string != ''")
|
||||
q[:pool].to_a.each do |pool_name|
|
||||
case pool_name
|
||||
when "none"
|
||||
relation = relation.where.not(id: Pool.select("unnest(post_ids)"))
|
||||
when "any"
|
||||
relation = relation.where(id: Pool.select("unnest(post_ids)"))
|
||||
when "series"
|
||||
relation = relation.where(id: Pool.series.select("unnest(post_ids)"))
|
||||
when "collection"
|
||||
relation = relation.where(id: Pool.collection.select("unnest(post_ids)"))
|
||||
when /\*/
|
||||
relation = relation.where(id: Pool.name_matches(pool_name).select("unnest(post_ids)"))
|
||||
else
|
||||
relation = relation.where(id: Pool.named(pool_name).select("unnest(post_ids)"))
|
||||
end
|
||||
end
|
||||
|
||||
q[:pool_neg].to_a.each do |pool_name|
|
||||
case pool_name
|
||||
when "none"
|
||||
relation = relation.where(id: Pool.select("unnest(post_ids)"))
|
||||
when "any"
|
||||
relation = relation.where.not(id: Pool.select("unnest(post_ids)"))
|
||||
when "series"
|
||||
relation = relation.where.not(id: Pool.series.select("unnest(post_ids)"))
|
||||
when "collection"
|
||||
relation = relation.where.not(id: Pool.collection.select("unnest(post_ids)"))
|
||||
when /\*/
|
||||
relation = relation.where.not(id: Pool.name_matches(pool_name).select("unnest(post_ids)"))
|
||||
else
|
||||
relation = relation.where.not(id: Pool.named(pool_name).select("unnest(post_ids)"))
|
||||
end
|
||||
end
|
||||
|
||||
if q[:saved_searches]
|
||||
|
||||
Reference in New Issue
Block a user