DEV: Use a single registry for preloaded category custom fields (#24272)

There was a registry for preloaded site categories and a new one has
been introduced recently for categories serialized through a
CategoryList.

Having two registries created a lot of friction for developers and this
commit merges them into a single one, providing a unified API.
This commit is contained in:
Bianca Nenciu
2023-11-09 18:23:24 +02:00
committed by GitHub
parent e772bb9fce
commit bdb81b5346
3 changed files with 7 additions and 10 deletions

View File

@ -362,10 +362,10 @@ RSpec.describe CategoryList do
fab!(:category) { Fabricate(:category, user: admin) }
before { category.upsert_custom_fields("bob" => "marley") }
after { CategoryList.preloaded_category_custom_fields = Set.new }
after { Site.reset_preloaded_category_custom_fields }
it "can preloads custom fields" do
CategoryList.preloaded_category_custom_fields << "bob"
Site.preloaded_category_custom_fields << "bob"
expect(category_list.categories[-1].custom_field_preloaded?("bob")).to eq(true)
end