2016-12-22 11:08:35 -05:00
|
|
|
class WebHookPostSerializer < PostSerializer
|
2018-01-17 13:40:21 -05:00
|
|
|
|
|
|
|
attributes :topic_posts_count
|
|
|
|
|
2017-04-20 22:04:21 -04:00
|
|
|
def include_topic_title?
|
|
|
|
true
|
2016-12-22 11:08:35 -05:00
|
|
|
end
|
|
|
|
|
2017-04-20 22:04:21 -04:00
|
|
|
%i{
|
|
|
|
can_view
|
|
|
|
can_edit
|
|
|
|
can_delete
|
|
|
|
can_recover
|
|
|
|
can_wiki
|
2018-05-20 22:52:57 -04:00
|
|
|
actions_summary
|
|
|
|
can_view_edit_history
|
|
|
|
yours
|
|
|
|
primary_group_flair_url
|
|
|
|
primary_group_flair_bg_color
|
|
|
|
primary_group_flair_color
|
2019-03-10 23:04:17 -04:00
|
|
|
post_notice_time
|
|
|
|
post_notice_type
|
2017-04-20 22:04:21 -04:00
|
|
|
}.each do |attr|
|
|
|
|
define_method("include_#{attr}?") do
|
|
|
|
false
|
|
|
|
end
|
2016-12-22 11:08:35 -05:00
|
|
|
end
|
2018-01-17 13:40:21 -05:00
|
|
|
|
|
|
|
def topic_posts_count
|
2018-01-22 12:54:11 -05:00
|
|
|
object.topic ? object.topic.posts_count : 0
|
2018-01-17 13:40:21 -05:00
|
|
|
end
|
|
|
|
|
2016-12-22 11:08:35 -05:00
|
|
|
end
|