mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
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:
@@ -6,9 +6,6 @@ class CategoryList
|
||||
cattr_accessor :preloaded_topic_custom_fields
|
||||
self.preloaded_topic_custom_fields = Set.new
|
||||
|
||||
cattr_accessor :preloaded_category_custom_fields
|
||||
self.preloaded_category_custom_fields = Set.new
|
||||
|
||||
attr_accessor :categories, :uncategorized
|
||||
|
||||
def self.register_included_association(association)
|
||||
@@ -142,8 +139,8 @@ class CategoryList
|
||||
|
||||
@categories = query.to_a
|
||||
|
||||
if preloaded_category_custom_fields.any?
|
||||
Category.preload_custom_fields(@categories, preloaded_category_custom_fields)
|
||||
if Site.preloaded_category_custom_fields.any?
|
||||
Category.preload_custom_fields(@categories, Site.preloaded_category_custom_fields)
|
||||
end
|
||||
|
||||
include_subcategories = @options[:include_subcategories] == true
|
||||
|
||||
Reference in New Issue
Block a user