discourse/app/serializers/web_hook_topic_view_serializer.rb
Roman Rizzi 21c53ed249
FEATURE: Topic slow mode. (#10904)
Adds a new slow mode for topics that are heating up. Users will have to wait for a period of time before being able to post again.

We store this interval inside the topics table and track the last time a user posted using the last_posted_at datetime in the TopicUser relation.
2020-10-16 16:24:38 -03:00

42 lines
781 B
Ruby

# frozen_string_literal: true
class WebHookTopicViewSerializer < TopicViewSerializer
attributes :created_by,
:last_poster
%i{
post_stream
timeline_lookup
pm_with_non_human_user
draft
draft_key
draft_sequence
message_bus_last_id
suggested_topics
has_summary
actions_summary
current_post_number
chunk_size
topic_timer
details
image_url
slow_mode_seconds
}.each do |attr|
define_method("include_#{attr}?") do
false
end
end
def include_show_read_indicator?
false
end
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
end