From 1bb12ee1b6f0c5428a046bb01a2c12f969cc6480 Mon Sep 17 00:00:00 2001 From: Joshua Rosenfeld Date: Tue, 12 Jun 2018 16:46:31 -0400 Subject: [PATCH] Revert "Preload custom user fields when viewing flag queue" This reverts commit 5bd1c5cc95f8f78ab74342dabbaa2f6366f57a62. --- app/serializers/flagged_user_serializer.rb | 18 +----------------- lib/flag_query.rb | 5 +---- 2 files changed, 2 insertions(+), 21 deletions(-) diff --git a/app/serializers/flagged_user_serializer.rb b/app/serializers/flagged_user_serializer.rb index 3af12c772fa..c9ec0aa6e8e 100644 --- a/app/serializers/flagged_user_serializer.rb +++ b/app/serializers/flagged_user_serializer.rb @@ -3,8 +3,7 @@ class FlaggedUserSerializer < BasicUserSerializer :can_be_deleted, :post_count, :topic_count, - :ip_address, - :custom_fields + :ip_address def can_delete_all_posts scope.can_delete_all_posts?(object) @@ -18,19 +17,4 @@ class FlaggedUserSerializer < BasicUserSerializer object.ip_address.try(:to_s) end - def custom_fields - fields = User.whitelisted_user_custom_fields(scope) - - if scope.can_edit?(object) - fields += DiscoursePluginRegistry.serialized_current_user_fields.to_a - end - - result = {} - fields.each do |k| - result[k] = object.custom_fields[k] if object.custom_fields[k].present? - end - - result - end - end diff --git a/lib/flag_query.rb b/lib/flag_query.rb index e963269a4f3..1d833200d83 100644 --- a/lib/flag_query.rb +++ b/lib/flag_query.rb @@ -129,13 +129,10 @@ module FlagQuery # TODO: add serializer so we can skip this posts.map!(&:marshal_dump) - users = User.includes(:user_stat).where(id: user_ids.to_a).to_a - User.preload_custom_fields(users, User.whitelisted_user_custom_fields(guardian)) - [ posts, Topic.with_deleted.where(id: topic_ids.to_a).to_a, - users, + User.includes(:user_stat).where(id: user_ids.to_a).to_a, all_post_actions, total_rows ]