smarter updates on saved searches on tag batch changes #2674
This commit is contained in:
@@ -152,4 +152,8 @@ class SavedSearch < ActiveRecord::Base
|
||||
user.update_attribute(:has_saved_searches, false)
|
||||
end
|
||||
end
|
||||
|
||||
def tag_query_array
|
||||
Tag.scan_tags(tag_query)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -236,10 +236,14 @@ class Tag < ActiveRecord::Base
|
||||
list + tagstr.gsub(/-?source:".*?"/, "").scan(/\S+/).uniq
|
||||
end
|
||||
|
||||
def scan_tags(tags)
|
||||
def scan_tags(tags, options = {})
|
||||
tagstr = normalize(tags)
|
||||
list = tagstr.scan(/source:".*?"/) || []
|
||||
list + tagstr.gsub(/source:".*?"/, "").gsub(/[%,]/, "").scan(/\S+/).uniq
|
||||
list += tagstr.gsub(/source:".*?"/, "").gsub(/[%,]/, "").scan(/\S+/).uniq
|
||||
if options[:strip_metatags]
|
||||
list = list.map {|x| x.sub(/^[-~]/, "")}
|
||||
end
|
||||
list
|
||||
end
|
||||
|
||||
def parse_cast(object, type)
|
||||
|
||||
Reference in New Issue
Block a user