FEATURE: add `topic_filtered_posts_count` attribute to web hook post serializer.

FEATURE: add topic_filtered_posts_count attribute to web hook post serializer.

diff --git a/app/serializers/web_hook_post_serializer.rb b/app/serializers/web_hook_post_serializer.rb
index 030b55203b..2099a17c4c 100644
--- a/app/serializers/web_hook_post_serializer.rb
+++ b/app/serializers/web_hook_post_serializer.rb
@@ -3,6 +3,7 @@
 class WebHookPostSerializer < PostSerializer
 
   attributes :topic_posts_count,
+             :topic_filtered_posts_count,
              :topic_archetype,
              :category_slug
 
@@ -34,6 +35,10 @@ class WebHookPostSerializer < PostSerializer
     object.topic ? object.topic.posts_count : 0
   end
 
+  def topic_filtered_posts_count
+    object.topic ? object.topic.posts.where(post_type: Post.types[:regular]).count : 0
+  end
+
   def topic_archetype
     object.topic ? object.topic.archetype : ''
   end

GitHub sha: 400f79cf

Is that an N+1?

I don’t think so. We will never call the WebHookPostSerializer for an array of posts.

Fix the `WebHookPostSerializer` spec.