FIX: compatibility after allowlist rewording in Discourse

FIX: compatibility after allowlist rewording in Discourse

diff --git a/app/controllers/discourse_assign/assign_controller.rb b/app/controllers/discourse_assign/assign_controller.rb
index dcb261b..d9bf28d 100644
--- a/app/controllers/discourse_assign/assign_controller.rb
+++ b/app/controllers/discourse_assign/assign_controller.rb
@@ -102,7 +102,12 @@ module DiscourseAssign
         .select(AvatarLookup.lookup_columns)
         .to_a
 
-      User.preload_custom_fields(users, User.whitelisted_user_custom_fields(guardian))
+      # TODO Drop after Discourse 2.6.0 release
+      if User.respond_to?(:whitelisted_user_custom_fields)
+        User.preload_custom_fields(users, User.whitelisted_user_custom_fields(guardian))
+      else
+        User.preload_custom_fields(users, User.allowed_user_custom_fields(guardian))
+      end
 
       users = users.to_h { |u| [u.id, u] }
       topics.each do |t|

GitHub sha: 2fad44a6

1 Like