2016-12-23 00:08:35 +08:00
|
|
|
class WebHookPostSerializer < PostSerializer
|
2018-01-18 02:40:21 +08:00
|
|
|
|
|
|
|
attributes :topic_posts_count
|
|
|
|
|
2017-04-21 10:04:21 +08:00
|
|
|
def include_topic_title?
|
|
|
|
true
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|
|
|
|
|
2017-04-21 10:04:21 +08:00
|
|
|
%i{
|
|
|
|
can_view
|
|
|
|
can_edit
|
|
|
|
can_delete
|
|
|
|
can_recover
|
|
|
|
can_wiki
|
|
|
|
}.each do |attr|
|
|
|
|
define_method("include_#{attr}?") do
|
|
|
|
false
|
|
|
|
end
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|
2018-01-18 02:40:21 +08:00
|
|
|
|
|
|
|
def topic_posts_count
|
2018-01-23 01:54:11 +08:00
|
|
|
object.topic ? object.topic.posts_count : 0
|
2018-01-18 02:40:21 +08:00
|
|
|
end
|
|
|
|
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|