mirror of
https://github.com/discourse/discourse.git
synced 2025-01-18 15:35:31 +08:00
efb116d2bd
* FIX: Reset related site settings on general category delete If the new seeded General category is deleted we also need to delete the corresponding site setting for it so that we don't try and reference it. This fixes a bug in the category dropdown composer. This change creates the `clear_related_site_settings` after destroy hook that could also be used by other features in the future, like maybe when we have a `default_category_id` site_setting. Looks like if `nil` out a site setting it is set to `0`? ``` [9] pry(main)> SiteSetting.general_category_id = nil SiteSetting Load (0.4ms) SELECT "site_settings".* FROM "site_settings" WHERE "site_settings"."name" = 'general_category_id' LIMIT 1 => nil [10] pry(main)> SiteSetting.general_category_id => 0 ``` That is why the tests check if the value is `< 1` and not `nil`. * Use -1 instead of nil because it is the default |
||
---|---|---|
.. | ||
fabricators | ||
fixtures | ||
helpers | ||
import_export | ||
initializers | ||
integration | ||
integrity | ||
jobs | ||
lib | ||
mailers | ||
models | ||
multisite | ||
requests | ||
script/import_scripts | ||
serializers | ||
services | ||
support | ||
system | ||
tasks | ||
views | ||
rails_helper.rb | ||
regenerate_swagger_docs | ||
swagger_helper.rb |