From 871fcf1117bf7f5dd91a590da517dd2949eca888 Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Tue, 4 Jun 2019 08:44:10 +0530 Subject: [PATCH] PERF: omit user profile and private message stats in web hook serializer. --- Gemfile.lock | 2 +- app/serializers/web_hook_user_serializer.rb | 4 ++++ spec/serializers/web_hook_user_serializer_spec.rb | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index db8907d12f5..973ec588984 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -533,4 +533,4 @@ DEPENDENCIES webpush BUNDLED WITH - 1.17.3 + 2.0.1 diff --git a/app/serializers/web_hook_user_serializer.rb b/app/serializers/web_hook_user_serializer.rb index 4fd63a8abe6..b14f75a2647 100644 --- a/app/serializers/web_hook_user_serializer.rb +++ b/app/serializers/web_hook_user_serializer.rb @@ -3,6 +3,10 @@ class WebHookUserSerializer < UserSerializer attributes :external_id + def omit_stats + true + end + # remove staff attributes def staff_attributes(*attrs) end diff --git a/spec/serializers/web_hook_user_serializer_spec.rb b/spec/serializers/web_hook_user_serializer_spec.rb index 82ef437f6c5..1c7f2ed8a2f 100644 --- a/spec/serializers/web_hook_user_serializer_spec.rb +++ b/spec/serializers/web_hook_user_serializer_spec.rb @@ -23,7 +23,7 @@ RSpec.describe WebHookUserSerializer do it 'should only include the required keys' do count = serializer.as_json.keys.count - difference = count - 45 + difference = count - 43 expect(difference).to eq(0), lambda { message = ""