This commit is contained in:
r888888888
2013-07-18 16:01:17 -07:00
parent e9b877f326
commit f017a0ee11
3 changed files with 8 additions and 4 deletions

View File

@@ -16,7 +16,7 @@ class TagAlias < ActiveRecord::Base
end
def active
where("status = ?", "active")
where("status IN (?)", ["active", "processing"])
end
def search(params)
@@ -62,7 +62,7 @@ class TagAlias < ActiveRecord::Base
def self.to_aliased(names)
Array(names).flatten.map do |name|
Cache.get("ta:#{Cache.sanitize(name)}") do
ActiveRecord::Base.select_value_sql("select consequent_name from tag_aliases where status = 'active' and antecedent_name = ?", name) || name
ActiveRecord::Base.select_value_sql("select consequent_name from tag_aliases where status in ('active', 'processing') and antecedent_name = ?", name) || name
end
end.uniq
end

View File

@@ -15,7 +15,7 @@ class TagImplication < ActiveRecord::Base
module ClassMethods
# assumes names are normalized
def with_descendants(names)
(names + where("antecedent_name in (?) and status = ?", names, "active").map(&:descendant_names_array)).flatten.uniq
(names + where("antecedent_name in (?) and status in (?)", names, ["active", "processing"]).map(&:descendant_names_array)).flatten.uniq
end
end
@@ -26,7 +26,7 @@ class TagImplication < ActiveRecord::Base
until children.empty?
all.concat(children)
children = TagImplication.where("antecedent_name IN (?) and status = ?", children, "active").all.map(&:consequent_name)
children = TagImplication.where("antecedent_name IN (?) and status in (?)", children, ["active", "processing"]).all.map(&:consequent_name)
end
end.sort.uniq
end

View File

@@ -6,6 +6,10 @@ class CurrentUserTest < ActiveSupport::TestCase
CurrentUser.ip_addr = nil
end
teardown do
Thread.current[:safe_mode] = false
end
context ".safe_mode?" do
should "return true if the host contains the string host" do
req = mock(:host => "safebooru")