Allow searching by negated favgroup: metatag

This commit is contained in:
Toks
2015-08-07 16:54:22 -04:00
parent 7215a39d98
commit 5bc0eea161
2 changed files with 13 additions and 1 deletions

View File

@@ -312,6 +312,14 @@ class PostQueryBuilder
relation = relation.order("position(' '||posts.id||' ' in ' '||(select post_ids from pools where id = #{pool_id})||' ')")
end
if q[:favgroup_neg].present?
favgroup_id = q[:favgroup_neg].to_i
favgroup = FavoriteGroup.where("favorite_groups.id = ?", favgroup_id).first
if favgroup
relation = relation.where("posts.id NOT in (?)", favgroup.post_id_array)
end
end
if q[:favgroup].present?
favgroup_id = q[:favgroup].to_i
favgroup = FavoriteGroup.where("favorite_groups.id = ?", favgroup_id).first