FIX: Preload the right fields on categories (#25213)

Co-authored-by: Daniel Waterworth <me@danielwaterworth.com>
This commit is contained in:
Penar Musaraj 2024-01-10 15:25:28 -05:00 committed by GitHub
parent 26e07fa051
commit 75772910c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -161,12 +161,11 @@ module Chat
end end
def self.preload_custom_fields_for(channels) def self.preload_custom_fields_for(channels)
preload_fields = Category.instance_variable_get(:@custom_field_types).keys
Category.preload_custom_fields( Category.preload_custom_fields(
channels channels
.select { |c| c.chatable_type == "Category" || c.chatable_type == "category" } .select { |c| c.chatable_type == "Category" || c.chatable_type == "category" }
.map(&:chatable), .map(&:chatable),
preload_fields, Site.preloaded_category_custom_fields,
) )
end end