A platform for community discussion. Free, open, simple.
PERF: Remove unnecessary DB queries when preloading for chat (#19514)
Alan Guo Xiang Tan4ea6b09fc7af
diff --git a/plugins/chat/plugin.rb b/plugins/chat/plugin.rbindex 028ebcf4a84..f945a295f0e 100644--- a/plugins/chat/plugin.rb+++ b/plugins/chat/plugin.rb@@ -416,13 +416,13 @@ after_initialize doadd_to_serializer(:current_user, :needs_dm_retention_reminder) { true }add_to_serializer(:current_user, :has_joinable_public_channels) do- Chat::ChatChannelFetcher.secured_public_channels(+ Chat::ChatChannelFetcher.secured_public_channel_search(self.scope,- Chat::ChatChannelMembershipManager.all_for_user(self.scope.user),following: false,limit: 1,status: :open,- ).present?+ exclude_dm_channels: true+ ).exists?endadd_to_serializer(:current_user, :chat_channels) do