From c23481913174490b9b1f7db374c92eca14039f5e Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Thu, 9 Nov 2023 18:52:04 +0200 Subject: [PATCH] DEV: Use new API to preload category custom fields (#521) --- plugin.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugin.rb b/plugin.rb index e10fd9f..fb4d9f2 100644 --- a/plugin.rb +++ b/plugin.rb @@ -171,7 +171,12 @@ after_initialize do on(:unassign_topic) { |topic, unassigning_user| Assigner.new(topic, unassigning_user).unassign } - Site.preloaded_category_custom_fields << "enable_unassigned_filter" + if respond_to?(:register_preloaded_category_custom_fields) + register_preloaded_category_custom_fields("enable_unassigned_filter") + else + # TODO: Drop the if-statement and this if-branch in Discourse v3.2 + Site.preloaded_category_custom_fields << "enable_unassigned_filter" + end BookmarkQuery.on_preload do |bookmarks, bookmark_query| if SiteSetting.assign_enabled?