bug fix for saved search update on tag batch changes

This commit is contained in:
Albert Yi
2016-12-28 12:40:00 -08:00
parent 92c1a561e0
commit b2296cab70
2 changed files with 15 additions and 3 deletions

View File

@@ -22,10 +22,10 @@ module Moderator
tags = Tag.scan_tags(antecedent, :strip_metatags => true)
conds = tags.map {|x| "tag_query like ?"}.join(" AND ")
conds = [conds, *tags.map {|x| "%#{x}%"}]
conds = [conds, *tags.map {|x| "%#{x.to_escaped_for_sql_like}%"}]
if SavedSearch.enabled?
SavedSearch.where(*conds).find_each do |ss|
ss.tag_query = (ss.tag_query_array - tags + antecedent).uniq.join(" ")
ss.tag_query = (ss.tag_query_array - tags + [consequent]).uniq.join(" ")
ss.save
end
end