mirror of
https://github.com/discourse/discourse.git
synced 2025-06-26 22:31:35 +08:00
workaround incorrect uncategorized category id set in site settings
This commit is contained in:
@ -2,7 +2,10 @@
|
|||||||
ActiveRecord::Base.send(:subclasses).each{|m| m.reset_column_information}
|
ActiveRecord::Base.send(:subclasses).each{|m| m.reset_column_information}
|
||||||
|
|
||||||
SiteSetting.refresh!
|
SiteSetting.refresh!
|
||||||
if SiteSetting.uncategorized_category_id == -1 || !Category.exists?(SiteSetting.uncategorized_category_id)
|
uncat_id = SiteSetting.uncategorized_category_id
|
||||||
|
uncat_id = -1 unless Numeric === uncat_id
|
||||||
|
|
||||||
|
if uncat_id == -1 || !Category.exists?(uncat_id)
|
||||||
puts "Seeding uncategorized category!"
|
puts "Seeding uncategorized category!"
|
||||||
|
|
||||||
result = Category.exec_sql "SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'"
|
result = Category.exec_sql "SELECT 1 FROM categories WHERE lower(name) = 'uncategorized'"
|
||||||
|
Reference in New Issue
Block a user