From c642a18d431760d5f8b4beeab6c4f3a211756a3c Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Tue, 7 Nov 2023 12:14:10 +0200 Subject: [PATCH 1/2] FIX: Preload category custom fields --- plugin.rb | 3 +++ 1 file changed, 3 insertions(+) diff --git a/plugin.rb b/plugin.rb index 5a82c950..a0030eec 100644 --- a/plugin.rb +++ b/plugin.rb @@ -168,6 +168,9 @@ module ::DiscourseAssign on(:unassign_topic) { |topic, unassigning_user| Assigner.new(topic, unassigning_user).unassign } Site.preloaded_category_custom_fields << "enable_unassigned_filter" + if self.respond_to?(:register_category_list_preloaded_category_custom_fields) + register_category_list_preloaded_category_custom_fields("enable_unassigned_filter") + end BookmarkQuery.on_preload do |bookmarks, bookmark_query| if SiteSetting.assign_enabled? From 93c6add9d846a9ddc9865f7e7c0762face9b5864 Mon Sep 17 00:00:00 2001 From: Bianca Nenciu Date: Thu, 9 Nov 2023 18:29:19 +0200 Subject: [PATCH 2/2] Update plugin.rb --- plugin.rb | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/plugin.rb b/plugin.rb index a0030eec..2c807828 100644 --- a/plugin.rb +++ b/plugin.rb @@ -167,9 +167,11 @@ module ::DiscourseAssign on(:unassign_topic) { |topic, unassigning_user| Assigner.new(topic, unassigning_user).unassign } - Site.preloaded_category_custom_fields << "enable_unassigned_filter" - if self.respond_to?(:register_category_list_preloaded_category_custom_fields) - register_category_list_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|