2019-05-03 06:17:27 +08:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-12-23 00:08:35 +08:00
|
|
|
class WebHookTopicViewSerializer < TopicViewSerializer
|
2018-05-21 10:28:12 +08:00
|
|
|
attributes :created_by,
|
|
|
|
:last_poster
|
2016-12-23 00:08:35 +08:00
|
|
|
|
2018-02-27 11:28:31 +08:00
|
|
|
%i{
|
|
|
|
post_stream
|
|
|
|
timeline_lookup
|
|
|
|
pm_with_non_human_user
|
|
|
|
draft
|
|
|
|
draft_key
|
|
|
|
draft_sequence
|
|
|
|
message_bus_last_id
|
2018-04-10 19:08:48 +08:00
|
|
|
suggested_topics
|
2018-05-21 10:28:12 +08:00
|
|
|
has_summary
|
|
|
|
actions_summary
|
|
|
|
current_post_number
|
|
|
|
chunk_size
|
|
|
|
topic_timer
|
|
|
|
private_topic_timer
|
|
|
|
details
|
2018-02-27 11:28:31 +08:00
|
|
|
}.each do |attr|
|
|
|
|
define_method("include_#{attr}?") do
|
|
|
|
false
|
|
|
|
end
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|
2018-05-21 10:28:12 +08:00
|
|
|
|
2019-08-27 20:09:00 +08:00
|
|
|
def include_show_read_indicator?
|
|
|
|
false
|
|
|
|
end
|
|
|
|
|
2018-05-21 10:28:12 +08:00
|
|
|
def created_by
|
|
|
|
BasicUserSerializer.new(object.topic.user, scope: scope, root: false)
|
|
|
|
end
|
|
|
|
|
|
|
|
def last_poster
|
|
|
|
BasicUserSerializer.new(object.topic.last_poster, scope: scope, root: false)
|
|
|
|
end
|
2016-12-23 00:08:35 +08:00
|
|
|
end
|