mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: add topic_filtered_posts_count
attribute to web hook post serializer.
This commit is contained in:
parent
c5140ef3fb
commit
400f79cffc
@ -3,6 +3,7 @@
|
|||||||
class WebHookPostSerializer < PostSerializer
|
class WebHookPostSerializer < PostSerializer
|
||||||
|
|
||||||
attributes :topic_posts_count,
|
attributes :topic_posts_count,
|
||||||
|
:topic_filtered_posts_count,
|
||||||
:topic_archetype,
|
:topic_archetype,
|
||||||
:category_slug
|
:category_slug
|
||||||
|
|
||||||
@ -34,6 +35,10 @@ class WebHookPostSerializer < PostSerializer
|
|||||||
object.topic ? object.topic.posts_count : 0
|
object.topic ? object.topic.posts_count : 0
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def topic_filtered_posts_count
|
||||||
|
object.topic ? object.topic.posts.where(post_type: Post.types[:regular]).count : 0
|
||||||
|
end
|
||||||
|
|
||||||
def topic_archetype
|
def topic_archetype
|
||||||
object.topic ? object.topic.archetype : ''
|
object.topic ? object.topic.archetype : ''
|
||||||
end
|
end
|
||||||
|
Loading…
Reference in New Issue
Block a user