mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
DEV: Add category custom field preloading to CategoryList (#23969)
This commit also introduced a plugin API for preloading category custom fields.
This commit is contained in:
@@ -6,6 +6,9 @@ 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)
|
||||
@@ -139,6 +142,10 @@ class CategoryList
|
||||
|
||||
@categories = query.to_a
|
||||
|
||||
if preloaded_category_custom_fields.any?
|
||||
Category.preload_custom_fields(@categories, preloaded_category_custom_fields)
|
||||
end
|
||||
|
||||
include_subcategories = @options[:include_subcategories] == true
|
||||
|
||||
notification_levels = CategoryUser.notification_levels_for(@guardian.user)
|
||||
|
||||
Reference in New Issue
Block a user