Skip to content

A platform for community discussion. Free, open, simple.

Add topic.posts_count to web_hook_posts_serializer

scossar2646eb5e1d56
diff --git a/app/serializers/web_hook_post_serializer.rb b/app/serializers/web_hook_post_serializer.rb
index 5d79ef5f483..623e8ab9df6 100644
--- a/app/serializers/web_hook_post_serializer.rb
+++ b/app/serializers/web_hook_post_serializer.rb
@@ -1,4 +1,7 @@
class WebHookPostSerializer < PostSerializer
+
+ attributes :topic_posts_count
+
def include_topic_title?
true
end
@@ -14,4 +17,9 @@ class WebHookPostSerializer < PostSerializer
false
end
end
+
+ def topic_posts_count
+ object.topic && object.topic.posts_count
+ end
+
end