mirror of
https://github.com/discourse/discourse.git
synced 2024-11-24 14:19:49 +08:00
26 lines
368 B
Ruby
26 lines
368 B
Ruby
class WebHookPostSerializer < PostSerializer
|
|
|
|
attributes :topic_posts_count
|
|
|
|
def include_topic_title?
|
|
true
|
|
end
|
|
|
|
%i{
|
|
can_view
|
|
can_edit
|
|
can_delete
|
|
can_recover
|
|
can_wiki
|
|
}.each do |attr|
|
|
define_method("include_#{attr}?") do
|
|
false
|
|
end
|
|
end
|
|
|
|
def topic_posts_count
|
|
object.topic ? object.topic.posts_count : 0
|
|
end
|
|
|
|
end
|